Digest #249 2024-01-06
Based on previous comments it's quite clear that both
COMPILE, should to check at runtime whether they are appending to an existing definition, or (as GForth puts it) "compiling outside a definition". Merely disallowing their usage in
@ STATE zero is not enough. But I'm wondering, if the system detects an attempt to append to a non-existing definition, what would be the most appropriate error code? -14 (interpreting a compile-only word)? -9 (invalid address)?
This may be very basic, but: are colon-definitions supposed to be compiled in data space (addressable by
! etc)? Can the thread of compiled XTs (or whatever the implementation uses) for a definition reside in some other address space, visible only to the inner interpreter or the equivalent? I suppose the answer is obvious, since presumably an implementation could compile everything to a primitive.
The difference is that the search order version contains the following words, but the core version does not:
after searching all the word lists in the search order
Concerning the interaction of the extension of
cs-pick and the
cs-drop with automatic scoping (a Gforth feature),
it does not pose any difficulties that were not there before.
However, these features may increase the probability that users run
into these (up-to-now extremely rare) difficulties.
Here's the case analysis for it:
For dests there is nothing new for
cs-pick. In the usual case when
begin that produced the dest is reachable from above,
results in the same situation that one would have if one had written
the code without the
begin. In the case when the
unreachable from above, it results in the same situation one would
have if the
begin was immediately followed by
the locals visible after the
begin are only those visible at the
latest place outside any control structure.
For origs, whatever
cs-drops are used, eventually the
orig is resolved by a
then, and the situation for automatic scoping
does not change compared to the case when the same code had been
The reason why these words do not change the situation is because
automatic scoping does not work with control-flow stack items except
when they are resolved by
again, or when the
: compile, ( xt -- ) postpone literal postpone execute ;It's not an efficient implementation, but a correct and portable one.
postpone execute part above needs to append
execute's XT to the current definition, i.e. a