Buy GNU books!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
Sometimes you want to define an anonymous word; a word without a name. You can do this with:
This leaves the execution token for the word on the stack after the
;. Here's an example in which a deferred word is
initialised with an
xt from an anonymous colon definition:
Defer deferred :noname ( ... -- ... ) ... ; IS deferred
Gforth provides an alternative way of doing this, using two separate words:
The previous example can be rewritten using
Defer deferred noname : ( ... -- ... ) ... ; lastxt IS deferred
noname works with any defining word, not just
lastxt also works when the last word was not defined as
noname. It does not work for combined words, though. It also has
the useful property that is is valid as soon as the header for a
definition has been built. Thus:
lastxt . : foo [ lastxt . ] ; ' foo .
prints 3 numbers; the last two are the same.
|webmaster||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|