Digest #60 2019-07-03
Contributions
requestClarification - How can the zero result be used in a Standard program?
Replies
I agree.
Appending something to the current definition when there is no current definition is obviously not a well-defined operation. Explicitly making it an ambiguous condition would be a good idea.
requestClarification - The case of undefined interpretation semantics
I think that, just as FIND may or may not return an xt, [DEFINED] may return true or false for this case; and I don't think that consistency between the choices for FIND and for [DEFINED] is required. I.e., [DEFINED] is based on the standard FIND, not necessarily on the system's FIND.
Again, I don't think that consistency is required. I also think that FIND should not throw in that case, but either return c-addr 0 or xt 1|-1. I also think that all systems behave that way.
I think that the intention of the committee is that applying [DEFINED] to any name is valid. I also think that all systems behave that way.
In any case, these are holes in the standard that should be fixed.
requestClarification - The case of undefined interpretation semantics
On which systems will
FIND
return 0 during interpretation for words with undefined interpretation?If a system has some way of distinguishing such words, say with a compile-only flag, what is the expectation when warnings are set?
Shouldn't
FIND
distinguish between not found and found but compile-only?Agreed. There is no need for either
FIND
or[DEFINED]
to throw. Either they find a defined word, or they don't.There is no reason why
[DEFINED]
shouldn't work on words with undefined interpretation. So, either:FIND
,'
and[']
always return the execution token of the most recent match. If the definition has no interpretation semantics, then a Standard program should not execute that xt unless compiling.FIND
may return a different xt when compiling than when interpreting.or if these do not find compile-only words, define
[DEFINE]
etc. using FIND-NAME: [DEFINED] parse-name find-name 0= ; IMMEDIATE
An ambiguous condition is not an error - it just indicates that different systems do different things. GForth is very strict. VFX is very tolerant - all words with names have FINDable XTs. This does not mean that executing the XT is useful or safe. It just means that an XT exists. We (MPE) use XTs for all sorts of functions like LOCATE and XREF tools. As a result of this ambiguity, words such as ' and ['] usually inherit their system's view of the world. For me, Forth is a dangerous language and should stay that way.