Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
RfD: SYNONYM
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 84 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Stephen Pelc  
View profile  
 More options Aug 21 2006, 11:49 am
Newsgroups: comp.lang.forth
From: stephen...@mpeforth.com (Stephen Pelc)
Date: Mon, 21 Aug 2006 15:49:32 GMT
Local: Mon, Aug 21 2006 11:49 am
Subject: RfD: SYNONYM
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
George Hubert  
View profile  
 More options Aug 21 2006, 12:28 pm
Newsgroups: comp.lang.forth
From: "George Hubert" <georgeahub...@yahoo.co.uk>
Date: 21 Aug 2006 09:28:16 -0700
Local: Mon, Aug 21 2006 12:28 pm
Subject: Re: RfD: SYNONYM

Win32Forth already supports SYNONYM with the same syntax.

George Hubert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "SYNONYM" by Andreas Kochenburger
Andreas Kochenburger  
View profile  
 More options Aug 21 2006, 1:45 pm
Newsgroups: comp.lang.forth
From: "Andreas Kochenburger" <a...@privat.de>
Date: Mon, 21 Aug 2006 19:45:17 +0200
Local: Mon, Aug 21 2006 1:45 pm
Subject: Re: SYNONYM

> The syntax is:
>  SYNONYM <newname> <oldname>
> where <newname> will behave identically to <oldname>.

ALIAS is used for the same purpose
' <oldname> ALIAS NEWNAME

Its syntax is similar to IS.
My personal vote is for ALIAS


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "RfD: SYNONYM" by J Thomas
J Thomas  
View profile  
 More options Aug 21 2006, 1:56 pm
Newsgroups: comp.lang.forth
From: "J Thomas" <jethom...@gmail.com>
Date: 21 Aug 2006 10:56:15 -0700
Local: Mon, Aug 21 2006 1:56 pm
Subject: Re: RfD: SYNONYM

Stephen Pelc wrote:
> 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.

....

> Ambiguous conditions:
>   The word newname is parsed by ' or ['] or POSTPONE.
>   oldname is not found.

I see no particular reason not to standardise this just as you say.
It's already reasonably common practice.

As a side issue, what behavior will a portable SYNONYM written in
standard Forth fail at, that doesn't involve ' or ['] or POSTPONE ? I
haven't found anything quickly.

This is as close as I came:

SYNONYM MY-DUP DUP

SYNONYM YOUR-DUP MY-DUP

A portable SYNONYM would probably use ' or ['] or POSTPONE on MY-DUP
here and fit the ambiguous condition, but a primitive SYNONYM wouldn't
have to.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "SYNONYM" by Coos Haak
Coos Haak  
View profile  
 More options Aug 21 2006, 2:05 pm
Newsgroups: comp.lang.forth
From: Coos Haak <chfo...@hccnet.nl>
Date: Mon, 21 Aug 2006 20:05:03 +0200
Local: Mon, Aug 21 2006 2:05 pm
Subject: Re: SYNONYM
Op Mon, 21 Aug 2006 19:45:17 +0200 schreef Andreas Kochenburger:

>> The syntax is:
>>  SYNONYM <newname> <oldname>
>> where <newname> will behave identically to <oldname>.

> ALIAS is used for the same purpose
> ' <oldname> ALIAS NEWNAME

> Its syntax is similar to IS.
> My personal vote is for ALIAS

I've been using this for years. Seems it is older than SYNONYM.

--
Coos

CHForth, 16 bit DOS applications
http://home.hccnet.nl/j.j.haak/forth.html


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen Pelc  
View profile  
 More options Aug 21 2006, 2:22 pm
Newsgroups: comp.lang.forth
From: stephen...@mpeforth.com (Stephen Pelc)
Date: Mon, 21 Aug 2006 18:22:25 GMT
Local: Mon, Aug 21 2006 2:22 pm
Subject: Re: SYNONYM
On Mon, 21 Aug 2006 19:45:17 +0200, "Andreas Kochenburger"

<a...@privat.de> wrote:
>> The syntax is:
>>  SYNONYM <newname> <oldname>
>> where <newname> will behave identically to <oldname>.

>ALIAS is used for the same purpose
>' <oldname> ALIAS NEWNAME

>Its syntax is similar to IS.
>My personal vote is for ALIAS

It breaks on some systems (and they exist) that cannot get from
the xt of a word to enough needed information to create the new
word. The point of SYNONYM is that it can be as carnal as necessary.

Stephen

--
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pablo reda  
View profile  
 More options Aug 21 2006, 8:52 pm
Newsgroups: comp.lang.forth
From: "pablo reda" <pablor...@gmail.com>
Date: 21 Aug 2006 17:52:47 -0700
Local: Mon, Aug 21 2006 8:52 pm
Subject: Re: SYNONYM
There are a complete example for know  the useful of ALIAS or something
?

I ask from ignorance but I don't think if is necessary,
I have only 1 year of forth programing..and 25 of others..


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "RfD: SYNONYM" by Ed
Ed  
View profile  
 More options Aug 23 2006, 8:49 pm
Newsgroups: comp.lang.forth
From: "Ed" <nos...@invalid.com>
Date: Thu, 24 Aug 2006 10:49:51 +1000
Local: Wed, Aug 23 2006 8:49 pm
Subject: Re: RfD: SYNONYM

"George Hubert" <georgeahub...@yahoo.co.uk> wrote in message

news:1156177696.845015.227430@m73g2000cwd.googlegroups.com...

> Stephen Pelc wrote:
> > RfD - Synonyms
> > ...
> > The syntax is:
> >   SYNONYM <newname> <oldname>
> > where <newname> will behave identically to <oldname>.

> > Note that <newname> may be the same as <oldname>.

> ...
> Win32Forth already supports SYNONYM with the same syntax.

Not so fast :)

I wonder how many missed the part in the spec about making
aliases with the same name!

A conforming  SYNONYM  should be able to handle this:

    \ Test SYNONYM ability to make alias with same name
    CR
    FORTH ALSO DEFINITIONS
    : TEST  ." hello " ;
    VOCABULARY NEWVOC
    NEWVOC DEFINITIONS
    SYNONYM TEST TEST  ( make alias in new vocab )
    CR .( now testing alias ) CR
    NEWVOC  TEST


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex McDonald  
View profile  
 More options Aug 24 2006, 7:04 am
Newsgroups: comp.lang.forth
From: "Alex McDonald" <alex_...@btopenworld.com>
Date: 24 Aug 2006 04:04:05 -0700
Local: Thurs, Aug 24 2006 7:04 am
Subject: Re: RfD: SYNONYM

You're right; Win32Forth fails this test due to a timing issue creating
the dictionary entry. At the point where SYNONYM is executed, the ORDER
is

order
Context: NEWVOC FORTH FORTH ROOT
Current: NEWVOC  ok

TEST is being defined, then searched for, rather than searched for then
defined; so it finds itself rather than the TEST in the FORTH
vocabulary. WIll be corrected.

--
Regards
Alex McDonald


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
George Hubert  
View profile  
 More options Aug 24 2006, 7:14 am
Newsgroups: comp.lang.forth
From: "George Hubert" <georgeahub...@yahoo.co.uk>
Date: 24 Aug 2006 04:14:45 -0700
Local: Thurs, Aug 24 2006 7:14 am
Subject: Re: RfD: SYNONYM

How slow do you want it. -;)

> I wonder how many missed the part in the spec about making
> aliases with the same name!

Not me I saw it.

> A conforming  SYNONYM  should be able to handle this:

>     \ Test SYNONYM ability to make alias with same name
>     CR
>     FORTH ALSO DEFINITIONS
>     : TEST  ." hello " ;
>     VOCABULARY NEWVOC
>     NEWVOC DEFINITIONS
>     SYNONYM TEST TEST  ( make alias in new vocab )
>     CR .( now testing alias ) CR
>     NEWVOC  TEST

Win32Forth supports that. I've used both SYNONYM and ALIAS (which
always makes the new word non-immediate irrespective of the immediacy
of the original) to have the same word in diffrent vocabularies many a
time. It's even used in the system for putting FORTH FORTH-WORDLIST and
SET-ORDER in the ROOT vocabulary (the one that's always available after
ONLY) as well as the FORTH vocabulary, so I know it works.

George Hubert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex McDonald  
View profile  
 More options Aug 24 2006, 7:18 am
Newsgroups: comp.lang.forth
From: "Alex McDonald" <alex_...@btopenworld.com>
Date: 24 Aug 2006 04:18:35 -0700
Local: Thurs, Aug 24 2006 7:18 am
Subject: Re: RfD: SYNONYM

Are you sure? I've just run it under 6.11.07 and it fails.

--
Regards
Alex McDonald


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
George Hubert  
View profile  
 More options Aug 24 2006, 7:23 am
Newsgroups: comp.lang.forth
From: "George Hubert" <georgeahub...@yahoo.co.uk>
Date: 24 Aug 2006 04:23:26 -0700
Local: Thurs, Aug 24 2006 7:23 am
Subject: Re: RfD: SYNONYM

All it needs is to hide the new word until after the second word is
looked up, which has the added advantage that if old-word isn't found
then new-word is hidden (similar to an incomplete : definition).

George Hubert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
George Hubert  
View profile  
 More options Aug 24 2006, 7:41 am
Newsgroups: comp.lang.forth
From: "George Hubert" <georgeahub...@yahoo.co.uk>
Date: 24 Aug 2006 04:41:04 -0700
Local: Thurs, Aug 24 2006 7:41 am
Subject: Re: RfD: SYNONYM

You're right (although the latest V6.11.09 from the cvs now works
correctly). It's ALIAS (where the xt is passed in) that worked whatever
the search order; SYNONYM requires the voc of old word to be earlier in
the search-order than the current voc. I couldn't run Ed's test for the
original post (or any other) since it hadn't been posted at the time.
V6.10 will also be modified to match; it just requires HIDE and REVEAL.

> --
> Regards
> Alex McDonald

George Hubert

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
J Thomas  
View profile  
 More options Aug 24 2006, 10:02 am
Newsgroups: comp.lang.forth
From: "J Thomas" <jethom...@gmail.com>
Date: 24 Aug 2006 07:02:19 -0700
Local: Thurs, Aug 24 2006 10:02 am
Subject: Re: RfD: SYNONYM
How would you attempt to write a portable definition for SYNONYM?

For a word "with default compilation behavior" it's easy.

: SYNONYM
   :
   BL WORD FIND DROP COMPILE,
   POSTPONE ; ;

You wind up with a new word that calls the old word. Standard programs
won't do R> DROP etc so they can't tell the difference between doing
one call and one return versus two calls and two returns. It ought to
just work.

But when you try to get synonyms for words that are active at compile
time then you run into all the problems Anton Ertl pointed out for
state-smartness etc. You need two  behaviors that will each happen at
precisely the right times and not at the wrong times, and there's no
way to be sure to get those behaviors with all combinations of
compilation, execution, POSTPONE, EXECUTE, and EVALUATE .

But Anton published a portable solution to that problem, where each
word gets two execution tokens and the system is instructed (in a
portable way) which of them to use. And it seems to me that if you use
Anton's system, you should be able to extend it simply for synonyms.
You can easily get the two xt's for the old word, and you can construct
the new word with them. So SYNONYM should be as portable as Anton's
method, for that particular set of problems.

What other portability problems are there?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
George Hubert  
View profile  
 More options Aug 24 2006, 12:11 pm
Newsgroups: comp.lang.forth
From: "George Hubert" <georgeahub...@yahoo.co.uk>
Date: 24 Aug 2006 09:11:51 -0700
Local: Thurs, Aug 24 2006 12:11 pm
Subject: Re: RfD: SYNONYM

J Thomas wrote:
> How would you attempt to write a portable definition for SYNONYM?

> For a word "with default compilation behavior" it's easy.

> : SYNONYM
>    :
>    BL WORD FIND DROP COMPILE,
>    POSTPONE ; ;

Why not;

: SYNONYM
   :
   BL WORD FIND 1 = IF IMMEDIATE THEN COMPILE,
   POSTPONE ; ;

 which takes care of whether the word is IMMEDIATE as well, although
neither version deals with the case of oldword not being found. It
wouldn't work correctly with separate intepret and compile xts though.

> You wind up with a new word that calls the old word. Standard programs
> won't do R> DROP etc so they can't tell the difference between doing
> one call and one return versus two calls and two returns. It ought to
> just work.

Somebody will want a synonym for R> >R  for some obscure reason -;)

> But when you try to get synonyms for words that are active at compile
> time then you run into all the problems Anton Ertl pointed out for
> state-smartness etc. You need two  behaviors that will each happen at
> precisely the right times and not at the wrong times, and there's no
> way to be sure to get those behaviors with all combinations of
> compilation, execution, POSTPONE, EXECUTE, and EVALUATE .

> But Anton published a portable solution to that problem, where each
> word gets two execution tokens and the system is instructed (in a
> portable way) which of them to use. And it seems to me that if you use
> Anton's system, you should be able to extend it simply for synonyms.
> You can easily get the two xt's for the old word, and you can construct
> the new word with them. So SYNONYM should be as portable as Anton's
> method, for that particular set of problems.

Depending on how dual xts are implemented it's possible to make SYNONYM
just point the name of to the same address as oldword points to, though
this means the 2 words behave exactly the same forevermore (i.e. if you
supply an optimised compile to newword then compiling oldword does the
same optimising from then on as well).

> What other portability problems are there?

Probably many. Separate wordlists for compilation words springs to
mind. I don't think a portable version for all systems is possible
though ones can be written for common implementation strategies; IMO
that's probably why it needs standardising.

George Hubert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
GerryJ  
View profile  
 More options Aug 24 2006, 3:04 pm
Newsgroups: comp.lang.forth
From: "GerryJ" <ge...@jackson9000.fsnet.co.uk>
Date: 24 Aug 2006 12:04:33 -0700
Local: Thurs, Aug 24 2006 3:04 pm
Subject: Re: RfD: SYNONYM

I've just implemented this as it seems a useful addition, although I
would have preferred SYNONYM <oldname> <newname> as it seems more
natural to find the old one before creating the new name but no matter.
I have the following questions, (nit picking I know but it is for a
standard):

1. Your reference implementation creates a new immediate word.
Therefore FIND <newname> will return a different result to FIND
<oldname> both due to a different xt (probably) and because <oldname>
may not be immediate. Does this matter?

2. If an implementation is an exact synonym i.e. FIND returns the same
xt and <newname> follows <oldname> immediacy as well as behaving
exactly the same, does SYNONYM count as a defining word in the terms of
the ANS standard e.g. if the old word abc is not immediate will

     SYNONYM xyz abc IMMEDIATE

make xyz or the previous definition immediate, or should it make both
xyz and abc immediate or is it an ambiguous condition. I think making
only xyz immediate is the best.

3. Just thought of this as I was about to post this message. With your
implementation would the following work?
     SYNONYM ENDIF THEN

For the record my implementation creates an exact synonym so '  ['] and
POSTPONE will all work with <newname> which I think is better than
making that an ambiguous condition.

Gerry


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
J Thomas  
View profile  
 More options Aug 24 2006, 3:04 pm
Newsgroups: comp.lang.forth
From: "J Thomas" <jethom...@gmail.com>
Date: 24 Aug 2006 12:04:37 -0700
Local: Thurs, Aug 24 2006 3:04 pm
Subject: Re: RfD: SYNONYM

George Hubert wrote:
> J Thomas wrote:
> > How would you attempt to write a portable definition for SYNONYM?
> > For a word "with default compilation behavior" it's easy.
> > : SYNONYM
> >    :
> >    BL WORD FIND DROP COMPILE,
> >    POSTPONE ; ;
> Why not;
> : SYNONYM
>    :
>    BL WORD FIND 1 = IF IMMEDIATE THEN COMPILE,
>    POSTPONE ; ;

I dunno. That might work. There were a lot of traps and I haven't
thought about it for awhile, maybe some of them would bite you on this.

To be on the safe side it might make sense to make it immediate after
you've postponed ; but I've never noticed an implementation that won't
make an incomplete definition immediate.

>  which takes care of whether the word is IMMEDIATE as well, although
> neither version deals with the case of oldword not being found. It
> wouldn't work correctly with separate intepret and compile xts though.

Yes. Two incompatible systems. One has tradition and the other works
better.

> Somebody will want a synonym for R> >R  for some obscure reason -;)

Oops! You got me there. So the simple implementation fails even when R>

>R have no special compilation behavior. So it fails.
> Depending on how dual xts are implemented it's possible to make SYNONYM
> just point the name of to the same address as oldword points to, though
> this means the 2 words behave exactly the same forevermore (i.e. if you
> supply an optimised compile to newword then compiling oldword does the
> same optimising from then on as well).

Yes.

> > What other portability problems are there?
> Probably many. Separate wordlists for compilation words springs to
> mind. I don't think a portable version for all systems is possible
> though ones can be written for common implementation strategies; IMO
> that's probably why it needs standardising.

Have you figured out how to do separate wordlists for compilation words
in a standard system? When I tried that it turned into a briar patch.
Define a new word with the old name that isn't immediate, and watch the
old version get found during compilation. Etc. Getting the standard
behaviors seemed to beg for a synonym in whichever wordset you aren't
defining in at the moment. Those systems are designed to work different
from standard, and it wrenches their soul to try to make them conform.

Anyway, if Anton's dual-wordlist approach can be implemented on any
standard system using only standard words, then it looks to me like
adding SYNONYM to it ought to be trivial. So SYNONYM should be very
widely portable.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Albert van der Horst  
View profile  
 More options Aug 24 2006, 3:45 pm
Newsgroups: comp.lang.forth
From: Albert van der Horst <alb...@spenarnc.xs4all.nl>
Date: 24 Aug 2006 19:45:46 GMT
Local: Thurs, Aug 24 2006 3:45 pm
Subject: Re: RfD: SYNONYM
In article <1156428139.572536.264...@h48g2000cwc.googlegroups.com>,

J Thomas <jethom...@gmail.com> wrote:
>How would you attempt to write a portable definition for SYNONYM?

<SNIP>

>What other portability problems are there?

I want to remark that it is important to standardize words
that *cannot* be portably implemented, or not efficiently.

It is much less important to standardize words that can
be portably implemented, as they can always be made
part of the application.

--
Groetjes Albert
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
alb...@spenarnc.xs4all.nl http://home.hccnet.nl/a.w.m.van.der.horst


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex McDonald  
View profile  
 More options Aug 25 2006, 4:54 am
Newsgroups: comp.lang.forth
From: "Alex McDonald" <alex_...@btopenworld.com>
Date: 25 Aug 2006 01:54:06 -0700
Local: Fri, Aug 25 2006 4:54 am
Subject: Re: RfD: SYNONYM
Albert van der Horst wrote:

Well, for the case of SYNONYM in the latest dual-xt version of W32F
based on Anton's suggestions (see here
http://www.complang.tuwien.ac.at/forth/header-ideas.html), it will be
important. To ensure the right behaviour with dual xts for words that
have non-standard compilation semantics, the synonym must either be an
immediate word that always executes the compile token of the underlying
word, or a complete copy of the dictionary entry. I can't think of a
portable ANS way to implement SYNONYM that would support such systems.

As an aside, this version of W32F passes the postpone test
(http://www.complang.tuwien.ac.at/forth/postponetest.fs).

--
Regards
Alex McDonald


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen Pelc  
View profile  
 More options Aug 25 2006, 6:04 am
Newsgroups: comp.lang.forth
From: stephen...@mpeforth.com (Stephen Pelc)
Date: Fri, 25 Aug 2006 10:04:31 GMT
Local: Fri, Aug 25 2006 6:04 am
Subject: Re: RfD: SYNONYM
On 24 Aug 2006 12:04:33 -0700, "GerryJ"

<ge...@jackson9000.fsnet.co.uk> wrote:
>1. Your reference implementation creates a new immediate word.
>Therefore FIND <newname> will return a different result to FIND
><oldname> both due to a different xt (probably) and because <oldname>
>may not be immediate. Does this matter?

No.

>2. If an implementation is an exact synonym i.e. FIND returns the same
>xt and <newname> follows <oldname> immediacy as well as behaving
>exactly the same, does SYNONYM count as a defining word in the terms of
>the ANS standard e.g. if the old word abc is not immediate will

>     SYNONYM xyz abc IMMEDIATE

>make xyz or the previous definition immediate, or should it make both
>xyz and abc immediate or is it an ambiguous condition. I think making
>only xyz immediate is the best.

IMMEDIATE affects the last dictionary entry which is XYZ.

I have already made this an ambiguous condition.

>3. Just thought of this as I was about to post this message. With your
>implementation would the following work?
>     SYNONYM ENDIF THEN

Yes.

Stephen

--
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anton Ertl  
View profile  
 More options Aug 25 2006, 4:25 pm
Newsgroups: comp.lang.forth
From: an...@mips.complang.tuwien.ac.at (Anton Ertl)
Date: Fri, 25 Aug 2006 20:25:55 GMT
Local: Fri, Aug 25 2006 4:25 pm
Subject: Re: RfD: SYNONYM
stephen...@mpeforth.com (Stephen Pelc) writes:
>Proposal
>========
>10.6.2.xxxx SYNONYM
>synonym FACILITY EXT

>( "<spaces>newname" "<spaces>oldname" -- )
>For both strings kip leading space delimiters. Parse name

                  ^^^ skip

> delimited by a space. Create a new word newname whose
>execution behaviour is identical to that of the existing word
>oldname.

"execution behaviour" is not a standard term.  If you mean "execution
semantics", then SYNONYM is no more powerful than ALIAS.  If you want
to make SYNONYM more powerful than ALIAS, how about the following
specification:

... Create a definition for newname with the semantics defined below:

  newname interpretation: ( i*x -- j*x )
    Perform the interpretation semantics of oldname

  newname compilation: ( i*x -- j*x )
    Perform the compilation semantics of oldname

> Newname may be the same as oldname.

That's true by default, so leave it away here; you may want to point
it out in an informal part.

>Ambiguous conditions:
>  The word newname is parsed by ' or ['] or POSTPONE.

No!  If you can tick or POSTONE oldname, you should also be able to do
this to newname, or it won't be a synonym.  Moreover, having words
that cannot be ticked or postponed in the standard is bad enough, we
don't need to add defining words for such monstrosities; I would
consider a language that had such defining words to be not Forth.
Also, I don't see a technical reason for such a restriction
(especially if you don't make [COMPILE] newword ambiguous).

- 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/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anton Ertl  
View profile  
 More options Aug 25 2006, 4:38 pm
Newsgroups: comp.lang.forth
From: an...@mips.complang.tuwien.ac.at (Anton Ertl)
Date: Fri, 25 Aug 2006 20:38:55 GMT
Local: Fri, Aug 25 2006 4:38 pm
Subject: Re: RfD: SYNONYM

"J Thomas" <jethom...@gmail.com> writes:
>But Anton published a portable solution to that problem, where each
>word gets two execution tokens and the system is instructed (in a
>portable way) which of them to use.

Actually my implementation has bugs, but since nobody seemed
interested, fixing them never got to the top of my agenda.

> And it seems to me that if you use
>Anton's system, you should be able to extend it simply for synonyms.

>You can easily get the two xt's for the old word,

Does not seems so easy to me.

Hmm, the xt for the compilation semantics could be constructed like
this:

:noname POSTPONE oldname ;

The interpretation semantics might be gotten by just ticking the word
(and maybe CATCHING any errors).  But for words with undefined
interpretation semantics, one might not get what one wants.

Still, it looks like it is possible to do it (apart from the return
stack words, as someone else mentioned).

- 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/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anton Ertl  
View profile  
 More options Aug 25 2006, 4:51 pm
Newsgroups: comp.lang.forth
From: an...@mips.complang.tuwien.ac.at (Anton Ertl)
Date: Fri, 25 Aug 2006 20:51:11 GMT
Local: Fri, Aug 25 2006 4:51 pm
Subject: Re: RfD: SYNONYM

"George Hubert" <georgeahub...@yahoo.co.uk> writes:
>Why not;

>: SYNONYM
>   :
>   BL WORD FIND 1 = IF IMMEDIATE THEN COMPILE,
>   POSTPONE ; ;

|6.1.1550 ... For a given string, the values returned by FIND while
|compiling may differ from those returned while not compiling.

In any case, this version of SYNONYM would not work as it should when
defining a synonym for S" on Gforth.

>It
>wouldn't work correctly with separate intepret and compile xts though.

Yes, that's it.

- 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/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Compilation wordlist (was: RfD: SYNONYM)" by Anton Ertl
Anton Ertl  
View profile  
 More options Aug 25 2006, 4:55 pm
Newsgroups: comp.lang.forth
From: an...@mips.complang.tuwien.ac.at (Anton Ertl)
Date: Fri, 25 Aug 2006 20:55:11 GMT
Local: Fri, Aug 25 2006 4:55 pm
Subject: Compilation wordlist (was: RfD: SYNONYM)

"J Thomas" <jethom...@gmail.com> writes:
>Have you figured out how to do separate wordlists for compilation words
>in a standard system? When I tried that it turned into a briar patch.
>Define a new word with the old name that isn't immediate, and watch the
>old version get found during compilation.

I think the right approach is to have a wordlist for the
interpretation/execution semantics of standard words, a wordlist for
the compilation semantics of standard words, and a wordlist for
user-defined words.  In interpretation state, you search user, then
interpretation; in compilation state, you search user, then
compilation, then interpretation.

Of course, this scheme becomes complicated once you want to implement
the search-order wordset, so complicated that it isn't worth doing.

- 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/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark W. Humphries  
View profile  
 More options Aug 25 2006, 9:47 pm
Newsgroups: comp.lang.forth
From: "Mark W. Humphries" <m...@intranetsys.com>
Date: 25 Aug 2006 18:47:59 -0700
Local: Fri, Aug 25 2006 9:47 pm
Subject: Re: Compilation wordlist (was: RfD: SYNONYM)

Anton Ertl wrote:
> I think the right approach is to have a wordlist for the
> interpretation/execution semantics of standard words, a wordlist for
> the compilation semantics of standard words, and a wordlist for
> user-defined words.  In interpretation state, you search user, then
> interpretation; in compilation state, you search user, then
> compilation, then interpretation.

[snip]

I find it simpler to reserve 2 extra bits in each header, an
interpretation bit, a compilation bit, in addition to the traditional
precedence (i.e. immediate) bit.

A normal word has interpretation=1 compilation=1 precedence=0
A normal immediate word has i=1 c=1 p=0
A compile-only non-immediate word has i=0 c=1 p=0
A directive (i.e. compile-only immediate) word has i=0 c=1 p=1
An interpret-only word has i=1 c=0 p=0

Cheers,
 Mark W. Humphries
 Manila, Philippines


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 84   Newer >
« Back to Discussions « Newer topic     Older topic »