If you want a test, it's following.
Let us have the helpers:
: leave-compilation ( -- ) postpone [ ;
: enter-compilation ( -- ) ] ;
The behavior that the Forth system demonstrates when the text
interpreter encounters the word name "foo" in compilation state can be identified by the execution semantics of the following word:
: behave-via-evaluate ( i*x -- j*x )
enter-compilation \ start in compilation state
s" foo" evaluate
leave-compilation \ revert interpretation state at the end
;
The behavior of your test can be identified by the word:
: behave-via-name-compile ( i*x -- j*x )
leave-compilation \ ensure interpretation state
s" foo" find-name name>compile execute-foo
leave-compilation \ ensure interpretation state at the end
;
We ensure interpretation state at the beginning of this word since your
test is started in interpretation state:
s" foo" find-name name>compile execute
For the sake of simplicity, the input source was not made identical in
these two ways of performing the behavior, but it can easy corrected.
According the the term definitions for the term "compilation semantics",
the words "behave-via-evaluate" and "behave-via-name-compile" should
always produce the same effects (with mentioned reservation about
different input sources).
On 10/21/22 06:23, Ruvim wrote:
On 2022-10-20 22:01, Krishna Myneni wrote:
On 10/20/22 15:25, Ruvim wrote:[...]
And it's an expected behavior for your test, regardless how a word
"foo" is defined. Isn't it?
Regardless how the word "foo" is defined, should your test demonstrate
the same behavior that the system demonstrates when the Forth text
interpreter encounters the word name "foo" in compilation state?
Perhaps you can pose your question in the form of a test, using only
standard words, so that there is no possibility of misunderstanding.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 475 |
Nodes: | 16 (2 / 14) |
Uptime: | 19:01:42 |
Calls: | 9,487 |
Calls today: | 6 |
Files: | 13,617 |
Messages: | 6,121,093 |