Liste des Groupes | Revenir à cl forth |
Ruvim <ruvim.pinka@gmail.com> writes:Do you agree that this describes an observable behavior, not an implementation? And all the implementations for execution semantics that show this behavior are observationally equivalent to each other?- All standard programs are single-xt programs (in the part ofWho proposes removing that? I often write about the interpretatation
user-defined words). Why we should remove the way to document this
programs/words in the standard terms of interpretation semantics,
compilation semantics and execution semantics?
and compilation semantics of various words with default compilation
semantics or with immediate compilation semantics, and I see nobody
who wants to remove that possibility.
Examples:
: foo 1 ;
The execution semantics of FOO are to push 1 on the data stack.
The interpretation semantics of FOO are to push 1 on the data stack.
The compilation semantics of FOO are append the execution semantics of
FOO to the current definition.
: bar state @ ; immediate
The execution semantics of BAR are to push the contents of STATE on
the data stack.
The interpretation semantics of BAR are to push the contents of STATEI think, we should use the black box model — specify what can be observed. And according to what can be observed, the interpretation semantics of this word are to push zero on the data stack. *All* implementations for interpretation semantics that show this behavior are observationally equivalent to each other. The same black box argument applies to compilation semantics too. See bellow.
on the data stack.
The compilation semantics of BAR are to push the contents of STATE onAnton, forgive me for being blunt, but I think your understanding of "interpretation semantics" and "compilation semantics" for words whose execution semantics depend on STATE is useless both in practice and in theory.
the data stack.
With that we can then determine what code like[1] Well, I can see only one reason for using another meaning for the "interpretation semantics" and "compilation semantics" terms than given above: to represent the classic implementation of `postpone` as conforming to what is formally specified in Forth-94, without accepting into the standard the proposed ambiguous condition (see [2]). But it is better to honestly say that "postpone" appends execution semantics of the word if this word is an immediate word. There is no need to blur the meaning of terms.
: bla postpone bar ; immediate
bla . \ prints 0
] bla [ . \ prints -1
should do; I show the output in comments. I just tested gforth,
iforth, SwiftForth, and VFX Forth, and unsurprisingly they all produce
the output shown in the comments.
Les messages affichés proviennent d'usenet.