On 2021-07-12 16:19, P Falth wrote:
> On Monday, 12 July 2021 at 14:46:34 UTC+2, Ruvim wrote:
>> On 2021-07-10 14:42, Krishna Myneni wrote:
>>> On 7/7/21 11:57 AM, Ruvim wrote:
>>>> On 2021-06-21 14:42, Krishna Myneni wrote:
>>>>> On 6/19/21 3:03 PM, Ruvim wrote:
>>>>> ...
>>>>>>
>>>>>> Let "foo" is a word that doesn't perform any parsing, doesn't access
>>>>>> the parse area, and doesn't enter into compilation or interpretation
>>>>>> state (i.e., any such behavior is not a part of any semantics for
>>>>>> "foo").
(1)
Yes, it is possible too. Hence you need to compare xt-comp with xt of
"COMPILE,", instead of zero.
Anyway, this variation doesn't affect my reasoning.
The problem I refer to is the same for any system implementation that
meets the mentioned conditions. Yes, "NAME>COMPILE" may return any xt at
the top. But it violates the specification *if* it returns xt of the
word and xt of "EXECUTE" for the nt of an immediate STATE-dependent
word. In the same time the rationale implies that this case meets the
specification (i.e., it's correct).
The specification says:
"Executing xt consumes x and performs the compilation semantics of
the word represented by nt".
It says nothing about any additional conditions. It means that in
compilation state the phrase:
[ "foo" find-name name>compile execute ]
should perform the CS for *any* available word "foo" that meets (1)
above. Hence, this phrase should be equivalent to the phrase:
foo
in compilation state (2).
According to the rationale, "name>compile" may return xt of the word and
xt of "EXECUTE" for an immediate word. But this equivalence is not held
*if* this immediate word is STATE-dependent.
For example, if "foo" is defined as
: foo state @ 0<> . ; immediate
and "name>compile" returns ( xt(foo) xt(execute) ) -- according to the
rationale, then the phrases above produce the different results [4].
So we have two options for "name>compile" glossary entry:
a) update the specification to relax implementations and tight
programs (specify that the returned xt should be performed in
compilation state);
b) update the rationale, remove the incorrect case, describe
implementation options for traditional xt+immediate-flag system.
[4] The Anton's position was that the compilation semantics for a word
may include such behavior that cannot be observed in compilation state.
And therefore the consequence (2) is incorrect.
Actually, the standard notion of "execution semantic" doesn't allow such
behavior for compilation semantics:
compilation semantics: The behavior of a Forth definition when its
name is encountered by the text interpreter in compilation state.
So it looks like Anton used another notion of CS. Also, this position
makes impossible some useful equivalences with "postpone" (like P1
above), since the specification for "postpone" relies on "compilation
semantics" notion.
I don't sure whether Anton still sticks on this position.
--
Ruvim