Name

synonym:header — definining primitive

Synopsis

EXTENSIONS
SYNONYM ( "newname" "oldname" -- )(); 
 ;

Description

make an name-alias for a word - this is very different from a DEFER since a DEFER will resolve at runtime. Changing the target of a DEFER via IS will result in changing the BEHAVIOR of all words defined earlier and containing the name of the DEFER.

A SYNONYM however does not have any data field (theoretically not even an execution token), instead it gets resolved at compile time. In theory, you can try to FIND the name of the SYNONYM but as soon as you apply NAME> the execution token of the end-point is returned. This has also the effect that using the inverse >NAME operation will result in the name-token of the other name.

   SYNONYM CREATE <BUILDS ( like it is in ANS Forth )
   : FOO CREATE DOES> @ ;
   SEE FOO
   : foo <builds
     does> @ ;
   SYNONYM CREATE CREATE:
   : BAR CREATE 10 ALLOT ;
   SEE BAR
   : bar create: 10 allot ;

(only LINK> does not care about SYNONYMs)