Node:Const-does>, Previous:Advanced does> usage example, Up:User-defined Defining Words



Const-does>

A frequent use of create...does> is for transferring some values from definition-time to run-time. Gforth supports this use with

doc-const-does>

A typical use of this word is:

: curry+ ( n1 "name" -- )
1 0 CONST-DOES> ( n2 -- n1+n2 )
    + ;

3 curry+ 3+

Here the 1 0 means that 1 cell and 0 floats are transferred from definition to run-time.

The advantages of using const-does> are:

An ANS Forth implementation of const-does> is available in compat/const-does.fs.