Replies: 2 comments 3 replies
-
1. If the name argument to « 2. If the name argument to « 3. Thus, « Update: as well as « 4. A recognizable syntax like « FactorsAn interesting question is how « This is also related to the factors of « However, there is an issue with introducing a separate throw code for cases where required semantics are not defined. This is because « : to ' state @ if compile-store-value exit then value! ; immediate
\ for simplicity, local variables are not processed hereIn this implementation, « We could make the implementation more complex: : to ' [: state @ if compile-store-value exit then value! ;] catch dup -21 = if drop -32 then throw ; immediateThis way, we could have different error codes for « But is it worth the complexity? |
Beta Was this translation helpful? Give feedback.
-
|
Error messages should be helpful. IMHO,
If you don't go through a recognizer, you can skip the -32 option. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Preamble
In the standard, the Table 9.1:
THROWcode 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
tomight 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:
-13undefined word-32invalid name argument (e.g., TO name)-21unsupported 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