On 2021-05-05 17:37, Stephen Pelc wrote:
> On Wed, 05 May 2021 11:46:26 GMT, an...@mips.complang.tuwien.ac.at
> (Anton Ertl) wrote:
>> The standard stack effect of COMPILE, is ( xt -- ). If COMPILE,
>> behaves differently on your system, it's non-standard. I reported
>> this bug to you in 2015
> NDCS = non default compilation semantics, e.g. IF
> And that's probably what triggered my NDCS esploration. The base
> problem comes from the standard's definitions of words. There are
> three cases:
> 1) normal words
> 2) immediate words
> 3) NDCS words
It's unclear do you mean the glossary entries, or the implementations in
particular Forth system?
In which group does the EXIT word fall?
The immediate words have non default compilation semantics. Probably you
wanted to place in the group 3 the NDCS words that are not implemented
as immediate words. And then the distribution of the words per these
three groups is system/implementation dependent. In some systems the
group 3 is empty.
> The standard only says how to handle cases 1) and 2).
You are right, the standard doesn't say how to perform compilation
semantics for NDCS words that are not immediate words.
The standard also doesn't say how to perform interpretation semantics
for the words with non default interpretation semantics.
It's the internal matters of a Forth system. And a Forth system even is
not obligated to use "COMPILE," or "EXECUTE" in its Forth text
interpreter at all.
But whatever matters a system does under the hood, it should not affect
the standard interfaces.
> So the answer to Ruvim's problem is "Don't do that".
This claim requires another ground.
> Until the standard encompasses NDCS words, the standard is incomplete.
Actually the standard does provide a mechanism to implement NDCS words —
it's the mechanism of immediacy — and this mechanism is capable to
implement any non default compilation semantics, and even default
compilation semantics in some exotic cases.
You also admit this in your "Special Words in Forth" paper, with
pointing to the problems in the popular implementations.
In the same time a system is allowed to use any other suitable mechanism
for that as well as the standard immediacy mechanism.
> The standard deliberately does not mandate implementation techniques
> and VFX uses a technique for NDCS words that is useful, but breaks
> careless tests.
Nothing internal implementation details can excuse a system in breaking
the specified interface of the "COMPILE," word.
> The EuroForth papers are there to read, and nobody has
> said that my analysis is wrong.
It says that "COMPILE," may do optimization. It's correct.
Also it says that "COMPILE," can be used to perform compilation
semantics for the words like "IF", but then "COMPILE," will be broken:
| This technique can also be used for other words such as "IF",
| with the deliberate intention that the interpretation
| and compilation actions of a word can be separated.
| However, "COMPILE," is then broken as far as current standards
| are concerned because structure words such as "IF" produce
| or consume stack items, and string words parse the input stream.
It's also correct.
Even "IF" may be implemented as an ordinary word. The only requirement
is that the unspecified side effects of its compilation via "COMPILE,"
should be undetectable by a standard program. For example, a system can
use special internal stack for "orig". Or it can resolve "orig" in the
> My conclusion from all this is that the standard has a bug in it.
Hope I can convince you that there mentioned issue is not a bug, but
something like misunderstanding.
> Unfortunately, fixing the bug will be a real pain.
A bug should be provable by an example.