You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
name: a token delimited by space, equivalent to «ccc<space>» or «ccc<eol>»
Side note: in the word name parse-name, «name» refers to a token delimited by space (a lexeme). But in the word names name>, find-name, find-name-in, name>string, name>compile, name>interpret, «name» refers to the name token (nt). This is an inconsistency in naming.
So, "name argument" is an immediate argument from the input source. For example, in the phrase «to xxx», "xxx" is an immediate argument.
Update: in some cases a name argument is not an immediate argument. For example, if a word is an ordinary word such as «'», «constant», and it's used in a definition body.
Question
The word to might detect the following problems with its immediate argument:
— a word with this name is not found in the search order;
— a word is found, but it is not created with value (or a such), i.e., "TO name" semantics are not defined for this word.
My question is: what throw code would be best for each of these cases?
The candidates are:
-13 undefined word
-32 invalid name argument (e.g., TO name)
-21 unsupported operation (e.g., AT-XY on a too-dumb terminal)
What are your arguments in favor of using one option or another?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Preamble
In the standard, the Table 9.1:
THROW
code assignments contains the line:The term «name» refers to a parameter in the stack diagram, e.g. for
TO
:( i*x "<spaces>name" -- )
( "<spaces>name" -- )
This is the so-called parsed-text notation, in which:
Side note: in the word name
parse-name
, «name» refers to a token delimited by space (a lexeme). But in the word namesname>
,find-name
,find-name-in
,name>string
,name>compile
,name>interpret
, «name» refers to the name token (nt). This is an inconsistency in naming.So, "name argument" is an immediate argument from the input source. For example, in the phrase «
to xxx
», "xxx" is an immediate argument.Update: in some cases a name argument is not an immediate argument. For example, if a word is an ordinary word such as «
'
», «constant
», and it's used in a definition body.Question
The word
to
might detect the following problems with its immediate argument:— a word with this name is not found in the search order;
— a word is found, but it is not created with
value
(or a such), i.e., "TO name" semantics are not defined for this word.My question is: what throw code would be best for each of these cases?
The candidates are:
-13
undefined word-32
invalid name argument (e.g., TO name)-21
unsupported operation (e.g., AT-XY on a too-dumb terminal)What are your arguments in favor of using one option or another?
Beta Was this translation helpful? Give feedback.
All reactions