Stephen Pelc wrote:
> RfD - Synonyms
> Synonym.txt
> Stephen Pelc, 21 August 2006
> 20060821 First draft
> Rationale
> =========
> Problem
> -------
> Various words have been used to gneration a new name for an
> existing word. This required when porting code and when
> generating application wordlists that contain a reference
> to an existing word, e.g. when providing limited access
> to Forth system kernel words.
> Especially with native code compiling Forth systems, these
> words have not provided full access to the required behaviour
> which requires carnal knowledge of the underlying system, which
> is one reason why SYNONYM should be standardised.
> Current practice
> ----------------
> The proposed form SYNONYM has been in use at MPE with cross
> compilers and VFX Forth since 1998.
> Solution
> --------
> Although many people have objected to parsing words, parsing
> permits the host system the most flexibility in implementation
> and is thus the preferred solution.
> The syntax is:
> SYNONYM <newname> <oldname>
> where <newname> will behave identically to <oldname>.
> Note that <newname> may be the same as <oldname>.
> Proposal
> ========
> 10.6.2.xxxx SYNONYM
> synonym FACILITY EXT
> ( "<spaces>newname" "<spaces>oldname" -- )
> For both strings kip leading space delimiters. Parse name
> delimited by a space. Create a new word newname whose
> execution behaviour is identical to that of the existing word
> oldname. Newname may be the same as oldname.
> Ambiguous conditions:
> The word newname is parsed by ' or ['] or POSTPONE.
> oldname is not found.
> Labelling
> =========
> TBD
> Reference Implementation
> ========================
> The implementation of SYNONYM requires carnal knowledge of the host
> implementation, which is one reason why it should be standardised.
> The implementation below is imperfect and specific to VFX Forth.
> : Synonym \ <"new-name"> <"curdef"> --
> \ *G Create a new definition which redirects to an existing one.
> create immediate
> hide ' , reveal
> does>
> @ state @ 0= over immediate? or
> if execute else compile, then
> ;
> Test Cases
> ==========
> TBD
> --
> Stephen Pelc, stephen...@mpeforth.com
> MicroProcessor Engineering Ltd - More Real, Less Time
> 133 Hill Lane, Southampton SO15 5AF, England
> tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
> web: http://www.mpeforth.com - free VFX Forth downloads
Win32Forth already supports SYNONYM with the same syntax.