does>
is used to specify a run-time action for the child words of
a defining word.
We can make our own variant of constant
and test it.
: make-con create , does> @ ; ok<#,ram> 53 make-con prime ok<#,ram>At run time for the defining word
make-con
, create sets up the new dictionary entry with the
next text in the input stream (prime
), the word ,
(comma) compiles TOS
(53 in this example) into the memory-space of the new child word and
does>
stores the following words up to the terminating
semicolon (only @
in this case), such that they will be executed at the run time
of the child word defined by make-con
.
Thus, when prime
is executed, the address of the first entry in its data-space
is put onto the stack and the word @
executed.
prime . 53 ok<#,ram>Although only one word is stored as the run time code for
prime
in this example,
it could be arbitrarily complex.