HolonT Forth
Words
Stack
Objects
Variables
Compiling
Postfix
Chess

Variables

Global

The defined objecttypes are global. Global variables can be used in code and colon words without a Tcl "global" declaration.

Local

Local variables are also handled as objecttypes. Initially a local has the type variable, thus the messages and methods of a variable apply to a local. The variable can be cast to a different type.

Example:

: validMoves ( from | to move victim -- res )
    cast move string    cast res list 
    {} res setlist
    board names { to} foreach
        " $from-$to" move set
        move valid? if
            to board victim set
            " -$victim" move append 
            move res append
        then
    repeat
    res sort  ;