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
Aliases
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 28 - 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
 
Brad  
View profile  
 More options Feb 7, 11:53 am
Newsgroups: comp.lang.forth
From: Brad <hwfw...@gmail.com>
Date: Tue, 7 Feb 2012 08:53:41 -0800 (PST)
Local: Tues, Feb 7 2012 11:53 am
Subject: Aliases
Hi All,

I want to copy existing words into a new wordlist.

My first thought was to use:

: &  ( <w> -- )  >IN @ ' SWAP >IN !  CREATE ,  DOES> @ EXECUTE ;

However, this doesn't work for copying IMMEDIATE words. I can use
EVALUATE, but it's very wordy:

: &  ( <w> -- )
   S" : " PAD PLACE  BL WORD DUP >R  COUNT 2DUP PAD APPEND
   S"  " PAD APPEND
   R> FIND NIP  DUP IF  1 =
   IF S" POSTPONE " PAD APPEND  PAD APPEND
      S"  ; IMMEDIATE" PAD APPEND       \ : FOO POSTPONE FOO ;
IMMEDIATE
   ELSE  PAD APPEND  S"  ;" PAD APPEND  \ : FOO FOO ;
   THEN
   PAD COUNT EVALUATE
   ELSE 3DROP THEN                      \ Not found, don't make an
alias
;

Is there a simpler (but portable) way? Does 200x propose ALIAS?

-Brad


 
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.
BruceMcF  
View profile  
 More options Feb 7, 12:25 pm
Newsgroups: comp.lang.forth
From: BruceMcF <agil...@netscape.net>
Date: Tue, 7 Feb 2012 09:25:03 -0800 (PST)
Local: Tues, Feb 7 2012 12:25 pm
Subject: Re: Aliases
On Feb 7, 11:53 am, Brad <hwfw...@gmail.com> wrote:

> Hi All,

> I want to copy existing words into a new wordlist.

> My first thought was to use:

> : &  ( <w> -- )  >IN @ ' SWAP >IN !  CREATE ,  DOES> @ EXECUTE ;

> However, this doesn't work for copying IMMEDIATE words. I can use
> EVALUATE, but it's very wordy:

I see why you switch from ' to FIND to get the IMMEDIATE status, but I
don't see why you switch to EVALUATE at the same time.

Wouldn't something along the lines of ...

: does-@EXECUTE ( -- ) DOES> @ EXECUTE ;
: & ( "word" -- )
   >IN @ BL WORD FIND ?DUP IF
      ROT >IN ! CREATE SWAP , does-@EXECUTE
      1 = IF IMMEDIATE THEN
   ELSE CR ." Cannot find: " COUNT TYPE DROP
   THEN ;

... do it?


 
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 Feb 7, 12:59 pm
Newsgroups: comp.lang.forth
From: stephen...@mpeforth.com (Stephen Pelc)
Date: Tue, 07 Feb 2012 17:59:33 GMT
Local: Tues, Feb 7 2012 12:59 pm
Subject: Re: Aliases
On Tue, 7 Feb 2012 08:53:41 -0800 (PST), Brad <hwfw...@gmail.com>
wrote:

>I want to copy existing words into a new wordlist.

>My first thought was to use:

>: &  ( <w> -- )  >IN @ ' SWAP >IN !  CREATE ,  DOES> @ EXECUTE ;

...

>Is there a simpler (but portable) way? Does 200x propose ALIAS?

SYNONYM <newname> <oldname>

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.
Brad  
View profile  
 More options Feb 7, 1:05 pm
Newsgroups: comp.lang.forth
From: Brad <hwfw...@gmail.com>
Date: Tue, 7 Feb 2012 10:05:13 -0800 (PST)
Local: Tues, Feb 7 2012 1:05 pm
Subject: Re: Aliases
On Feb 7, 10:59 am, stephen...@mpeforth.com (Stephen Pelc) wrote:
> SYNONYM <newname> <oldname>

Okay. But for brevity (and since the names are identical):

: &        ( <name> -- )
   >IN @ BL WORD FIND  DUP 0= THROW  ROT >IN !
   CREATE SWAP ,   1 = IF IMMEDIATE THEN
   DOES> @ EXECUTE ;


 
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 Wills  
View profile  
 More options Feb 8, 5:31 am
Newsgroups: comp.lang.forth
From: Mark Wills <markrobertwi...@yahoo.co.uk>
Date: Wed, 8 Feb 2012 02:31:06 -0800 (PST)
Local: Wed, Feb 8 2012 5:31 am
Subject: Re: Aliases
On Feb 7, 5:59 pm, stephen...@mpeforth.com (Stephen Pelc) wrote:

I thought Synonym would only create a synonym. It doesn't copy the
original code into a new word.

The OP wants to duplicate a word from one wordlist into another. Not
quite the same as SYNONYM.

Nevertheless, that raises an interesting point in itself; One might
consider, rather than just blindly copying the executable code into
the new word, compiling a call to the original word instead. It saves
space on constrained systems.


 
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 Feb 8, 6:19 am
Newsgroups: comp.lang.forth
From: stephen...@mpeforth.com (Stephen Pelc)
Date: Wed, 08 Feb 2012 11:19:54 GMT
Local: Wed, Feb 8 2012 6:19 am
Subject: Re: Aliases
On Wed, 8 Feb 2012 02:31:06 -0800 (PST), Mark Wills

<markrobertwi...@yahoo.co.uk> wrote:
>> >Is there a simpler (but portable) way? Does 200x propose ALIAS?

>> SYNONYM <newname> <oldname>

>I thought Synonym would only create a synonym. It doesn't copy the
>original code into a new word.

>The OP wants to duplicate a word from one wordlist into another. Not
>quite the same as SYNONYM.

What Brad's code does is to generate a new word of the form
  : foo  foo  ;
which is not the same as copying the binary. Copying the binary is
actually quite hard to do on some implementations and CPUs.

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.
Alex McDonald  
View profile  
 More options Feb 8, 6:13 am
Newsgroups: comp.lang.forth
From: Alex McDonald <b...@rivadpm.com>
Date: Wed, 8 Feb 2012 03:13:05 -0800 (PST)
Local: Wed, Feb 8 2012 6:13 am
Subject: Re: Aliases
On Feb 8, 10:31 am, Mark Wills <markrobertwi...@yahoo.co.uk> wrote:

Then (assuming you have VOCABULARY, and this can obviously be extended
to wordlists);

: OLDNAME .... ;

VOCABULARY NEWVOC
ALSO NEWVOC DEFINITIONS

SYNONYM NEWNAME OLDNAME

PREVIOUS DEFINITIONS


 
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.
Elizabeth D. Rather  
View profile  
 More options Feb 8, 12:11 pm
Newsgroups: comp.lang.forth
From: "Elizabeth D. Rather" <erat...@forth.com>
Date: Wed, 08 Feb 2012 07:11:34 -1000
Local: Wed, Feb 8 2012 12:11 pm
Subject: Re: Aliases
On 2/8/12 1:19 AM, Stephen Pelc wrote:

And why would one actually want to do that?

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================


 
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.
BruceMcF  
View profile  
 More options Feb 8, 1:30 pm
Newsgroups: comp.lang.forth
From: BruceMcF <agil...@netscape.net>
Date: Wed, 8 Feb 2012 10:30:46 -0800 (PST)
Local: Wed, Feb 8 2012 1:30 pm
Subject: Re: Aliases
On Feb 8, 6:13 am, Alex McDonald <b...@rivadpm.com> wrote:

That does not, however, import the word under the same name as "&" is
trying to do. DEFER and IS would do so, I think, by reusing the word
in the input buffer. But if the extra semantics of DEFER and IS are
not required, the does-@EXECUTE approach would be about as compact:

: does-@EXECUTE DOES> @ EXECUTE ;
: & ( "name" -- )
   >IN @ BL WORD FIND ?DUP IF
      ROT >IN ! SWAP CREATE , does-@EXECUTE
      1 = IF IMMEDIATE THEN
   ELSE CR COUNT TYPE SPACE ." ???" THEN ;

: & ( "name" -- )
   >IN @ BL WORD FIND ?DUP IF
      ROT DUP >IN ! DEFER
      >IN ! SWAP ['] IS EXECUTE
      1 = IF IMMEDIATE THEN
   ELSE CR COUNT TYPE SPACE ." ???" THEN ;


 
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 Feb 8, 1:26 pm
Newsgroups: comp.lang.forth
From: Alex McDonald <b...@rivadpm.com>
Date: Wed, 8 Feb 2012 10:26:13 -0800 (PST)
Local: Wed, Feb 8 2012 1:26 pm
Subject: Re: Aliases
On Feb 8, 5:11 pm, "Elizabeth D. Rather" <erat...@forth.com> wrote:

Inlining, dynamic loading (particularly of libraries), "sandpit"
debugging, virtualisation, compilation out of line or off-processor,
and so on. The usual technique is to either keep a static set of
relocations that are applied when the code is loaded or moved; or
dynamically generate them by disassembling the code. It's usually
required for processors that utilise position dependent code.

Many of these may not apply to Forth, although inlining is an
exception.


 
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 Feb 8, 1:51 pm
Newsgroups: comp.lang.forth
From: stephen...@mpeforth.com (Stephen Pelc)
Date: Wed, 08 Feb 2012 18:51:48 GMT
Local: Wed, Feb 8 2012 1:51 pm
Subject: Re: Aliases
On Wed, 08 Feb 2012 07:11:34 -1000, "Elizabeth D. Rather"

<erat...@forth.com> wrote:
>> What Brad's code does is to generate a new word of the form
>>    : foo  foo  ;
>> which is not the same as copying the binary. Copying the binary is
>> actually quite hard to do on some implementations and CPUs.

>And why would one actually want to do that?

1) : foo foo ;
That's sometimes useful to expose words. Clients do it.
2) Binary copy
Some code generators (e.g. SwiftForth) do/did this.

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.
Elizabeth D. Rather  
View profile  
 More options Feb 8, 3:05 pm
Newsgroups: comp.lang.forth
From: "Elizabeth D. Rather" <erat...@forth.com>
Date: Wed, 08 Feb 2012 10:05:37 -1000
Local: Wed, Feb 8 2012 3:05 pm
Subject: Re: Aliases
On 2/8/12 8:26 AM, Alex McDonald wrote:

Ok, but my understanding of the OP was that he wanted to access the word
from a different wordlist. Stephen's SYNONYM does that nicely. Inlining
is a compiler strategy in itself, not particularly related to getting
something visible in a different wordlist. If wordlist visibility is the
issue, I don't see why copying the code itself is relevant.

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================


 
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 Feb 8, 5:19 pm
Newsgroups: comp.lang.forth
From: Alex McDonald <b...@rivadpm.com>
Date: Wed, 8 Feb 2012 14:19:09 -0800 (PST)
Local: Wed, Feb 8 2012 5:19 pm
Subject: Re: Aliases
On Feb 8, 6:30 pm, BruceMcF <agil...@netscape.net> wrote:

: THISNAME .... ;
VOCABULARY NEWVOC
ALSO NEWVOC DEFINITIONS
SYNONYM THISNAME THISNAME
PREVIOUS DEFINITIONS

SYNONYM allows both names to be the same. Any system that declares and
finds the new THISNAME as its own alias is in error.

15.6.2. SYNONYM TOOLS EXT
For both strings skip leading space delimiters. Parse newname and
oldname delimited by a space. Create a definition for newname with the
semantics defined below. Newname may be the same as oldname; when
looking up oldname, newname shall not be found .


 
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.
BruceMcF  
View profile  
 More options Feb 8, 6:04 pm
Newsgroups: comp.lang.forth
From: BruceMcF <agil...@netscape.net>
Date: Wed, 8 Feb 2012 15:04:11 -0800 (PST)
Local: Wed, Feb 8 2012 6:04 pm
Subject: Re: Aliases
On Feb 8, 5:19 pm, Alex McDonald <b...@rivadpm.com> wrote:

> SYNONYM allows both names to be the same.

Yes, but the specified behavior was for the name to appear once.

> Any system that declares and
> finds the new THISNAME as its own alias is in error.

Yes, that's why the original name was searched for and its xt found
first, before executing DEFER and the interpreter semantics of IS.

 
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.
BruceMcF  
View profile  
 More options Feb 8, 6:05 pm
Newsgroups: comp.lang.forth
From: BruceMcF <agil...@netscape.net>
Date: Wed, 8 Feb 2012 15:05:22 -0800 (PST)
Local: Wed, Feb 8 2012 6:05 pm
Subject: Re: Aliases
On Feb 8, 5:19 pm, Alex McDonald <b...@rivadpm.com> wrote:

> SYNONYM allows both names to be the same. Any system that declares and
> finds the new THISNAME as its own alias is in error.

Is the SYNONYM of an immediate word defined to be immediate?

 
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.
Elizabeth D. Rather  
View profile  
 More options Feb 9, 1:55 pm
Newsgroups: comp.lang.forth
From: "Elizabeth D. Rather" <erat...@forth.com>
Date: Thu, 09 Feb 2012 08:55:40 -1000
Local: Thurs, Feb 9 2012 1:55 pm
Subject: Re: Aliases
On 2/8/12 1:05 PM, BruceMcF wrote:

> On Feb 8, 5:19 pm, Alex McDonald<b...@rivadpm.com>  wrote:
>> SYNONYM allows both names to be the same. Any system that declares and
>> finds the new THISNAME as its own alias is in error.

> Is the SYNONYM of an immediate word defined to be immediate?

I think not automatically.  You would have to mark your synonym as
immediate. It can conceivably be useful to define a non-immediate
synonym of an immediate word.

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================


 
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 Feb 9, 4:36 pm
Newsgroups: comp.lang.forth
From: Alex McDonald <b...@rivadpm.com>
Date: Thu, 9 Feb 2012 13:36:58 -0800 (PST)
Local: Thurs, Feb 9 2012 4:36 pm
Subject: Re: Aliases
On Feb 9, 6:55 pm, "Elizabeth D. Rather" <erat...@forth.com> wrote:

> On 2/8/12 1:05 PM, BruceMcF wrote:

> > On Feb 8, 5:19 pm, Alex McDonald<b...@rivadpm.com>  wrote:
> >> SYNONYM allows both names to be the same. Any system that declares and
> >> finds the new THISNAME as its own alias is in error.

> > Is the SYNONYM of an immediate word defined to be immediate?

> I think not automatically.  You would have to mark your synonym as
> immediate. It can conceivably be useful to define a non-immediate
> synonym of an immediate word.

According to the spec it's not portable. In the case of my Forth, the
word can be marked immediate because the old word's definition is
copied to newname. I can envisage dictionaries where the
implementation has names and pointers to header structures; in which
case, a shared header structure would result in also marking oldname
as immediate.

15.6.2. SYNONYM TOOLS EXT
( “<spaces>newname” “<spaces>oldname” -- ) X:synonym
For both strings skip leading space delimiters. Parse newname and
oldname delimited by a space. Create a definition for newname with the
semantics defined below. Newname may be the same as oldname; when
looking up oldname, newname shall not be found.

An ambiguous conditions exists if oldname can not be found or
IMMEDIATE is applied to newname.


 
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.
BruceMcF  
View profile  
 More options Feb 9, 8:44 pm
Newsgroups: comp.lang.forth
From: BruceMcF <agil...@netscape.net>
Date: Thu, 9 Feb 2012 17:44:49 -0800 (PST)
Local: Thurs, Feb 9 2012 8:44 pm
Subject: Re: Aliases
On Feb 9, 1:55 pm, "Elizabeth D. Rather" <erat...@forth.com> wrote:

> > Is the SYNONYM of an immediate word defined to be immediate?
> I think not automatically.  You would have to mark your synonym as
> immediate. It can conceivably be useful to define a non-immediate
> synonym of an immediate word.

Then for the target application, where the desire is for the immediacy
or not to be inherited, it wouldn't seem like much less trouble than
the BL WORD FIND approach.

 
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.
Gerry Jackson  
View profile  
 More options Feb 10, 4:32 am
Newsgroups: comp.lang.forth
From: Gerry Jackson <ge...@jackson9000.fsnet.co.uk>
Date: Fri, 10 Feb 2012 09:32:53 +0000
Local: Fri, Feb 10 2012 4:32 am
Subject: Re: Aliases
On 09/02/2012 21:36, Alex McDonald wrote:

> On Feb 9, 6:55 pm, "Elizabeth D. Rather"<erat...@forth.com>  wrote:
>> On 2/8/12 1:05 PM, BruceMcF wrote:

>>> On Feb 8, 5:19 pm, Alex McDonald<b...@rivadpm.com>    wrote:
>>>> SYNONYM allows both names to be the same. Any system that declares and
>>>> finds the new THISNAME as its own alias is in error.

>>> Is the SYNONYM of an immediate word defined to be immediate?

I think so, see below.

You omitted the next bit of the specification that the above refers to
for semantics and which says (from
www.forth200x.org/documents/forth11-1.pdf):

<quote>
newname interpretation: ( i*x -- j*x )
         Perform the interpretation semantics of oldname.
newname compilation: ( i*x -- j*x )
         Perform the compilation semantics of oldname.
</quote>

If oldname is immediate and an implementation doesn't make newname
immediate then their compilation semantics are different which violates
the second statement above.

Therefore ISTM that immediacy must be inherited and the answer to
Bruce's original question is yes.

--
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.
Alex McDonald  
View profile  
 More options Feb 10, 6:21 am
Newsgroups: comp.lang.forth
From: Alex McDonald <b...@rivadpm.com>
Date: Fri, 10 Feb 2012 03:21:58 -0800 (PST)
Local: Fri, Feb 10 2012 6:21 am
Subject: Re: Aliases
On Feb 10, 9:32 am, Gerry Jackson <ge...@jackson9000.fsnet.co.uk>
wrote:

Elizabeth was suggesting immediacy can be set on newname when oldname
is not immediate, which is ambiguous;

: foo ;
synonym bar foo immediate

This is ok;

: foo ; immediate
synonym bar foo


 
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 Feb 10, 6:32 am
Newsgroups: comp.lang.forth
From: an...@mips.complang.tuwien.ac.at (Anton Ertl)
Date: Fri, 10 Feb 2012 11:32:51 GMT
Local: Fri, Feb 10 2012 6:32 am
Subject: Re: Aliases

BruceMcF <agil...@netscape.net> writes:
>On Feb 8, 5:19=A0pm, Alex McDonald <b...@rivadpm.com> wrote:
>> SYNONYM allows both names to be the same. Any system that declares and
>> finds the new THISNAME as its own alias is in error.

>Is the SYNONYM of an immediate word defined to be immediate?

Yes: <http://www.forth200x.org/synonym.html>

- 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 2011: http://www.euroforth.org/ef11/


 
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.
Gerry Jackson  
View profile  
 More options Feb 10, 8:04 am
Newsgroups: comp.lang.forth
From: Gerry Jackson <ge...@jackson9000.fsnet.co.uk>
Date: Fri, 10 Feb 2012 13:04:13 +0000
Local: Fri, Feb 10 2012 8:04 am
Subject: Re: Aliases
On 10/02/2012 11:21, Alex McDonald wrote:

Not the way I read it, she was referring to an immediate oldname and
attempting to make newname match it by use of immediate ...

> which is ambiguous;

Correct

> : foo ;
> synonym bar foo immediate

> This is ok;

> : foo ; immediate
> synonym bar foo

Yes and bar is automatically immediate (or should be).

--
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.
Alex McDonald  
View profile  
 More options Feb 10, 8:07 am
Newsgroups: comp.lang.forth
From: Alex McDonald <b...@rivadpm.com>
Date: Fri, 10 Feb 2012 05:07:55 -0800 (PST)
Local: Fri, Feb 10 2012 8:07 am
Subject: Re: Aliases
On Feb 10, 1:04 pm, Gerry Jackson <ge...@jackson9000.fsnet.co.uk>
wrote:

OK, we're in violent agreement :-)

 
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.
JennyB  
View profile  
 More options Feb 10, 9:57 am
Newsgroups: comp.lang.forth
From: JennyB <jennybr...@googlemail.com>
Date: Fri, 10 Feb 2012 06:57:53 -0800 (PST)
Local: Fri, Feb 10 2012 9:57 am
Subject: Re: Aliases

Further, if a system has words with non-default and non-immediate semantics, shouldn't ' newname ( and ['] newname at runtime) return the interpretation semantics of oldname, and POSTPONE newname compile the compilation semantics of oldname, regardless of later STATE?

I'm beginning to see a way to Standardise such words, and still keep an interpreter that uses FIND:

   : CLONE  ( xt xtc ++ )
     CREATE  2, IMMEDIATE
       DOES> 2@ STATE @ 0= IF DROP THEN EXECUTE ;

   CLONE? ( xt -- f ) system dependent. I /think/ you can always non-portably
           recognize a DOES> word from its xt

   : 'COMP  ( ++ xt xtc  ) FIND ?DUP 0= IF
       COUNT TYPE [CHAR] ? EMIT ABORT THEN
         -1 = IF
         ['] COMPILE ELSE
       DUP CLONE? IF
       >BODY 2@ ELSE
       ['] EXECUTE THEN ;

  : '   'COMP DROP ;
  : ['] ' POSTPONE LITERAL ; IMMEDIATE

  : POSTPONE 'COMP DUP ['] EXECUTE = IF
                 DROP ELSE
                 SWAP POSTPONE LITERAL THEN
               COMPILE, ; IMMEDIATE

  : &  >IN @ >R 'COMP  
           R> >IN !  CLONE ;

  : SYNONYM  >IN @ >R BL WORD DROP \ skip new name for now
             'COMP  
                 >IN @ R> SWAP >R >IN ! CLONE  
             R> >IN !  ;

 \ Gforth Style Combined Words

: ct>xtc ( ct -- xtc ) >R :NONAME POSTPONE DROP R> COMPILE, POSTPONE ; ;

: INTERPRET/COMPILE: ct>xtc CLONE ;

In general, whenever you want to decorate the behaviour of an already-defined word, clone it.


 
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.
BruceMcF  
View profile  
 More options Feb 10, 12:05 pm
Newsgroups: comp.lang.forth
From: BruceMcF <agil...@netscape.net>
Date: Fri, 10 Feb 2012 09:05:18 -0800 (PST)
Local: Fri, Feb 10 2012 12:05 pm
Subject: Re: Aliases
On Feb 10, 4:32 am, Gerry Jackson <ge...@jackson9000.fsnet.co.uk>
wrote:

>>>> Is the SYNONYM of an immediate word defined to be immediate?
> I think so, see below.
...
> You omitted the next bit of the specification that
> the above refers to for semantics and which says
> (fromwww.forth200x.org/documents/forth11-1.pdf):
> <quote>
> newname interpretation: ( i*x -- j*x )
>          Perform the interpretation semantics of oldname.
> newname compilation: ( i*x -- j*x )
>          Perform the compilation semantics of oldname.
> </quote>

OK, thanks.

Then:

CREATE &BUFFER S" SYNONYM" S, 64 CHARS ALLOT
... and something to paste two copies of the "name" into that buffer
just saving the original count and doing a BL> and S> twice would load
up the word, then restore the original count and its ready for the
next use ... would support a "&" that took one copy of the name, and
then evaluate the buffer ... without the complication of handling the
immediacy itself, and also working for words that have more than just
EXECUTE and COMPILE, as compilation semantics.


 
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 28   Newer >
« Back to Discussions « Newer topic     Older topic »