www.delorie.com/gnu/docs/gforth/gforth_109.html   search  
 
Buy GNU books!


Gforth Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.9.10 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 section 5.11 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 5.10.1 Combined Words.

doc-alias


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003