\ create some instance variables 20 instance value alpha instance variable beta instance defer function 200 instance buffer: gamma cr ." Template data size: " instance-size . cr \ some test functions : incbeta ( -- ) beta @ 1+ to beta ; : incalpha ( -- ) alpha 1+ to alpha ; : pushone ( -- ) 1 ; : pushtwo ( -- ) 2 ; 30 to beta ' pushone to function \ allocate two instances and copy template data here dup instance-size allot value instance1 instance-init here dup instance-size allot value instance2 instance-init : report cr cr ." ALPHA : " alpha . cr ." BETA : " beta @ . cr ." DEFER : " function . cr ." GAMMA : " gamma . cr cr ; report \ enter instance 1 instance1 set-instance cr ." ---- INSTANCE ONE ----" report incalpha incbeta ' pushtwo to function report \ enter instance 2 instance2 set-instance cr ." ---- INSTANCE TWO ----" report incbeta incbeta report \ back to the no-instance case cr ." ---- TEMPLATE DATA ----" 0 set-instance report \ enter instance 1 cr ." ---- INSTANCE ONE ----" instance1 set-instance report