6.2.0698
ACTION-OF
 
CORE EXT
Interpretation:
( "<spaces>name" -- xt )

Skip leading spaces and parse name delimited by a space. xt is the execution token that name is set to execute. An ambiguous condition exists if name was not defined by DEFER, or if the name has not been set to execute an xt.

Compilation:
( "<spaces>name" -- )

Skip leading spaces and parse name delimited by a space. Append the run-time semantics given below to the current definition. An ambiguous condition exists if name was not defined by DEFER.

Run-time:
( -- xt )

xt is the execution token that name is set to execute. An ambiguous condition exists if name has not been set to execute an xt.

An ambiguous condition exists if POSTPONE, [COMPILE], ['] or ' is applied to ACTION-OF.

Implementation:
: ACTION-OF
   STATE @ IF
     POSTPONE ['] POSTPONE DEFER@
   ELSE
     ' DEFER@
   THEN ; IMMEDIATE
Testing:
T{ DEFER defer1 -> }T
T{ : action-defer1 ACTION-OF defer1 ; -> }T

T{ ' * ' defer1 DEFER! ->   }T
T{          2 3 defer1 -> 6 }T
T{ ACTION-OF defer1 -> ' * }T
T{    action-defer1 -> ' * }T

T{ ' + IS defer1 ->   }T
T{    1 2 defer1 -> 3 }T
T{ ACTION-OF defer1 -> ' + }T
T{    action-defer1 -> ' + }T