Proposal: Tick and undefined execution semantics
This page is dedicated to discussing this specific proposal
ContributeContributions
ruv [163] Tick and undefined execution semanticsProposal2020-10-29 00:28:43
Author
Ruv
Change Log
- 2019-07-16 Discussion in comments to Tick
- 2020-10-29 Initial version
Problem
Using of the word '
(Tick) is implicitly (and intrinsically) ambiguous in some cases, but this is not declared explicitly.
The word '
returns execution token that identifies execution semantics for the word in argument. Therefore, if execution semantics for a word are not defined by the standard, a program should not rely that Tick returns anything for this word, and that it returns control at all.
Solution
Declare an ambiguous condition for the case when Tick is applied to a word with undefined execution semantics.
For the most words, for which execution semantics are not defined, interpretation semantics are also not defined. And the standard already has the general rule that applying Tick to a word with undefined interpretation semantics is ambiguous. For the remaining words, for which interpretation semantics are defined, but execution semantics are not defined, the standard declares ambiguous condition individually for each such word. The only word that falls out of this line is the FILE S"
word.
The right way is to remove individual workarounds and introduce the single general rule.
Actually, it would be enough to declare an ambiguous condition only in the case of undefined execution semantics, and remove the declaration of an ambiguous condition in the case of undefined interpretation semantics. But we cannot do it while the compilation semantics for some words with undefined interpretation semantics still defined via execution semantics (e.g. >R
).
Side note
The situation with these words can be made better in some of the following ways:
a. Rename Execution section into Run-time section, and add Compilation section into each of these words.
b. Rename Execution section into Run-time section, and change the default compilation semantics that they are to append run-time semantics, and default run-time semantics are to perform execution semantics.
c. Rename Execution section into Run-time section, and change the default compilation semantics that they are to append run-time semantics if they are defined, or to append execution semantics otherwise.
So, at the moment, the general rule is that it's ambiguous to apply Tick to a word with undefined execution semantics or undefined interpretation semantics.
After refactoring the specifications for the words mentioned above, the part concerning undefined interpretation semantics can be removed.
All above is applied to [']
BracketTick as well as for Tick.
Proposal
In the glossary entries 6.1.0070 ' (Tick) and 6.1.2510 [']
(BracketTick)
Remove the phrase:
An ambiguous condition exists if name is not found.
And add the following Note
Note
An ambiguous condition exists if name is not found, or execution semantics for name are undefined, or interpretation semantics for name are undefined.
In the glossary entries 6.2.2295 TO
, 6.2.1725 IS
, 6.2.0698 ACTION-OF
,
replace the phrase:
An ambiguous condition exists if any of
POSTPONE
,[COMPILE]
,'
or[']
are applied toTO
.
by the phrase:
An ambiguous condition exists if
POSTPONE
or[COMPILE]
are applied toTO
.
The rationale: since in the standard, the general ambiguous conditions are not repeated for each word in argument.
In the section 4.1.2 Ambiguous conditions
replace the phrase:
attempting to obtain the execution token, (e.g., with 6.1.0070
'
, 6.1.1550FIND
, etc. of a definition with undefined interpretation semantics;
by the phrase:
attempting to obtain the execution token (e.g., with 6.1.0070
'
, 6.1.1550FIND
, etc.) of a definition with undefined execution semantics or undefined interpretation semantics;
(the excessive comma and missing right parenthesis are also fixed).