You. Forth. Simplicity.

git repository
download
prior releases
documentation wiki
issue tracker
mailing list and forum
irc channel and logs
try it


This wiki remains, like the original forum, mainly for historical value. There is a new wiki which, while having less content, is more secure and oriented towards modern Retro implementations.

reload node | edit | recent changes | front page

DOES>


{{
: reclass last @ d->class ! ;
: .does compiler @ -1 =if swap literal, compile pop drop ;; then drop ;
---reveal---
macro: does>
1 , here 0 , ( compile address of code after does> [will be patched] )
['] reclass compile ( compile a call to reclass, which assigns the code )
( after does> as the class handler for the word. )
['] ;; execute ( compile an exit, so no code following does> will be )
( executed when the create/does> sequence is run. )
here swap ! ( Patch the address from the 1 , here 0 , line to the )
( actual start of the code for the does> action. )
here literal, ( Compile the address following does> as a literal so )
( it can be used by the .does class. )
['] .does compile ( And finally, compile a call to the .does class, which )
( will take care of compile-time and interpret-time bits)
;
}}