Re: RfD: SYNONYM



"Neal Bridges" <nbridges@xxxxxxxxxxxx> writes:
ALIAS is already demonstrably common-usage, and ideally will create an exact
duplicate of oldname, flags and semantics and all.

Such an ALIAS has a conflict with Gforth's ALIAS, which just produces
a word that has the execution/interpretation semantics specified by
the xt, but default compilation semantics. In particular, it is not
immediate, whether the ticked word is immediate or not.

So a least common denominator would make the compilation semantics of
an ALIAS undefined, unless the original had default cmpilation
semantics (then it has default compilation semantics), or unless
IMMEDIATE is applied (then it is immediate).

With such an ALIAS, we cannot do as easily what SYNONYM can do, but we
can combine it with other techniques to achieve the same
functionality:

For a word with default compilation semantics, use

' R@ alias my-r@

For an immediate word, use

' ( alias my-* immediate

For a word with non-default compilation semantics und undefined
interpretation semantics, use:

: endif POSTPONE then ; immediate

For a word with defined interpretation semantics and non-default,
non-immediate compilation semantics, you could define it in a
STATE-smart way (and it will fail when the original will also fail on
some system), or you could use the refined technique discussed in
http://www.complang.tuwien.ac.at/forth/dpans-html/comment-semantics.html;
for simplicity, here's the state-smart variant:

: my-s"
state @ if
postpone S"
else
['] S" execute
then ; immediate

So what SYNONYM offers above ALIAS is the convenience of not having to
make this case analysis.

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2006: http://www.complang.tuwien.ac.at/anton/euroforth2006/
.



Relevant Pages

  • Re: Why Only On One PC?
    ... > Like I said semantics. ... You don't want to know what my lawyer has to say about this. ... Alias ...
    (microsoft.public.windowsxp.general)
  • Re: Why Only On One PC?
    ... I would really like to know what your lawyer has to say about ... Please get his verbiage and post it here. ... "Alias" wrote in message ... >> Like I said semantics. ...
    (microsoft.public.windowsxp.general)
  • Re: Why Only On One PC?
    ... I most certainly would like to read your lawyers answer. ... "Alias" wrote in message ... >> Like I said semantics. ...
    (microsoft.public.windowsxp.general)
  • Re: I dont understand the definition of DOES>
    ... CREATE name execution semantic (which means that the data field address is ... "Run-time semantics" is referred to in the section on compilation ... Many words with special compilation semantics are defined with a pair ...
    (comp.lang.forth)
  • Re: The IMMEDIATE mess
    ... and non IMMEDIATE words, it simply finds the word I'm asking for. ... That doesn't fit the standard, but it might easily fit the new ... a new definition with the same name and new semantics or extended ... This sounds to me like you want to extend the ...
    (comp.lang.forth)

Loading