Previous: Deferred Words, Up: Defining Words


5.9.11 Aliases

The defining word Alias allows you to define a word by name that has the same behaviour as some other word. Here are two situation where this can be useful:

Like deferred words, an alias has default compilation and interpretation semantics at the beginning (not the modifications of the other word), but you can change them in the usual ways (immediate, compile-only). For example:

     : foo ... ; immediate
     
     ' foo Alias bar \ bar is not an immediate word
     ' foo Alias fooby immediate \ fooby is an immediate word

Words that are aliases have the same xt, different headers in the dictionary, and consequently different name tokens (see Tokens for Words) and possibly different immediate flags. An alias can only have default or immediate compilation semantics; you can define aliases for combined words with interpret/compile: – see Combined words.

Alias       xt "name" –         gforth       “Alias”