-
How is NAME>INTERPRET typically implemented? There does not appear to be standard word to mark a word as compile-only (similar to IMMEDIATE). For primitives / built-ins its easy enough, but how is it done for defined words? Do defined words have to be state smart to throw -14 or other if interpreted? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The word It is supposed that
In classic single-xt systems this word corresponds to the word In dual-xt systems this word returns the primary xt for an nt, which identifies the execution semantics for the word identified by the nt.
In a standard program, user-defined words should somehow analyze state to throw an exception only in interpretation state. Classic single-xt systems do the same. Usually they have a helper word for that, something like:
|
Beta Was this translation helpful? Give feedback.
-
I have prepared a proposal to better specify what the results of NB: the standard defines default interpretation semantics (see 3.4.3.2), so they are undefined by the standard only if this fact is explicitly declared as "Interpretation: Interpretation semantics for this word are undefined". |
Beta Was this translation helpful? Give feedback.
The word
name>interpret
is insufficiently specified in Forth-2012. An irony is that this word (along withname>compile
andfind-name
) was supposed to replacefind
, sincefind
is insufficiently specified, but it got into the same problem.It is supposed that
name>interpret
returns the xt (execution token) of a word, the same xt that Tick returns for the word (or thatfind
returns in interpretation state).