-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace COMPILE and [COMPILE] with POSTPONE? #413
Comments
This is now getting more serious ;-) |
I've found a problem in I hadn't realized that |
Using POSTPONE in the lib worked fine. I'll now turn off the legacy words in By default the aliases |
More modern Forth implementations than eForth have long replaced
COMPILE
and[COMPILE]
with the more general word POSTPONE.The difference between the old and the new approach is this:
Compile a regular word:
a:
: test1a COMPILE DROP ;
=><CALL XT-COMPILE><CALL XT-DROP>
b:
: test1b POSTPONE DROP ;
=><LIT XT-DROP><CALL XT-CALL,>
Compile an IMMEDIATE word:
a:
: test2a [COMPILE] IF ;
=><CALL XT-IF>
b:
: test2b POSTPONE IF ;
=><CALL XT-IF>
When used as "macros" or directly as
IMMEDIATE
the wordstest1a
-test2a
andtest1b
-test2b
perform the same thing (COMPILE
intest1b
has to work around any STM8 eForth code optimization features which can be a big issue)There is an edge case when
[COMPILE]
is used to compile a regular word:a:
: test3a [COMPILE] DROP ;
=><CALL XT-DROP>
b:
: test3b POSTPONE DROP ;
=><LIT XT-DROP><CALL XT-CALL,>
Other edge cases exist if any of the words
POSTPONE
,COMPILE
or[COMPILE]
is used with words defined byCREATE
,CONSTANT
orVARIABLE
. I'll have to check what the "the standard` has to say about that.Before doing any such change I'd like to get some input from the community.
ALIAS
ing the legacy words toPOSTPONE
an acceptable solution?The text was updated successfully, but these errors were encountered: