IS

Interpretation:

( xt "<spaces>name" -- )

Skip leading spaces and parse name delimited by a space. Set name to execute xt.

An ambiguous condition exists if name was not defined by DEFER.

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 -- )

Set name to execute xt.

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

See:

Implementation:

: IS
   STATE @ IF
     POSTPONE ['] POSTPONE DEFER!
   ELSE
     ' DEFER!
   THEN ; IMMEDIATE

Testing:

T{ DEFER defer5 -> }T
T{ : is-defer5 IS defer5 ; -> }T

T{ ' * IS defer5 -> }T
T{ 2 3 defer5 -> 6 }T

T{ ' + is-defer5 -> }T
T{ 1 2 defer5 -> 3 }T

ContributeContributions