Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #45436 > unrolled thread

NAME! and NAME@ versus !NAME and @NAME

Started byLars Brinkhoff <lars.spam@nocrew.org>
First post2016-02-11 10:01 +0100
Last post2016-02-12 22:46 +0100
Articles 20 on this page of 27 — 11 participants

Back to article view | Back to comp.lang.forth


Contents

  NAME! and NAME@ versus !NAME and @NAME Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-11 10:01 +0100
    Re: NAME! and NAME@ versus !NAME and @NAME Mark Wills <markwills1970@gmail.com> - 2016-02-11 01:56 -0800
      Re: NAME! and NAME@ versus !NAME and @NAME Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-11 12:04 +0100
      Re: NAME! and NAME@ versus !NAME and @NAME "HAA" <someone@microsoft.com> - 2016-02-14 09:28 +1100
        Re: NAME! and NAME@ versus !NAME and @NAME hughaguilar96@gmail.com - 2016-02-13 21:45 -0800
    Re: NAME! and NAME@ versus !NAME and @NAME Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm> - 2016-02-11 05:02 -0500
    Re: NAME! and NAME@ versus !NAME and @NAME lehs <skydda.barnen@gmail.com> - 2016-02-11 02:40 -0800
      Re: NAME! and NAME@ versus !NAME and @NAME Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-11 12:10 +0100
        Re: NAME! and NAME@ versus !NAME and @NAME lehs <skydda.barnen@gmail.com> - 2016-02-11 03:37 -0800
          Re: NAME! and NAME@ versus !NAME and @NAME Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-11 13:04 +0100
    Re: NAME! and NAME@ versus !NAME and @NAME anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-11 10:51 +0000
      Re: NAME! and NAME@ versus !NAME and @NAME Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-11 12:33 +0100
        Re: NAME! and NAME@ versus !NAME and @NAME Coos Haak <chforth@hccnet.nl> - 2016-02-11 13:01 +0100
          Re: NAME! and NAME@ versus !NAME and @NAME Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-11 13:11 +0100
          Re: NAME! and NAME@ versus !NAME and @NAME Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-02-11 13:30 +0000
        Re: NAME! and NAME@ versus !NAME and @NAME anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-11 12:15 +0000
          Re: NAME! and NAME@ versus !NAME and @NAME Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-11 13:35 +0100
            Re: NAME! and NAME@ versus !NAME and @NAME Mark Wills <markwills1970@gmail.com> - 2016-02-11 05:06 -0800
              Re: NAME! and NAME@ versus !NAME and @NAME Chris Curl <ccurl609@gmail.com> - 2016-02-11 05:18 -0800
      Re: NAME! and NAME@ versus !NAME and @NAME Albert van der Horst <albert@spenarnc.xs4all.nl> - 2016-02-11 13:27 +0000
    Re: NAME! and NAME@ versus !NAME and @NAME stephen@mpeforth.com (Stephen Pelc) - 2016-02-11 12:35 +0000
    Re: NAME! and NAME@ versus !NAME and @NAME "HAA" <someone@microsoft.com> - 2016-02-12 16:58 +1100
      Re: NAME! and NAME@ versus !NAME and @NAME "HAA" <someone@microsoft.com> - 2016-02-12 17:41 +1100
        Re: NAME! and NAME@ versus !NAME and @NAME Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-12 08:56 +0100
      Re: NAME! and NAME@ versus !NAME and @NAME Lars Brinkhoff <lars.spam@nocrew.org> - 2016-02-12 08:13 +0100
        Re: NAME! and NAME@ versus !NAME and @NAME "HAA" <someone@microsoft.com> - 2016-02-13 01:36 +1100
          Re: NAME! and NAME@ versus !NAME and @NAME Coos Haak <chforth@hccnet.nl> - 2016-02-12 22:46 +0100

Page 1 of 2  [1] 2  Next page →


#45436 — NAME! and NAME@ versus !NAME and @NAME

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2016-02-11 10:01 +0100
SubjectNAME! and NAME@ versus !NAME and @NAME
Message-ID<8660xvzkm2.fsf@molnjunk.nocrew.org>
Leo Brodie's Forth style guide says:

  save value of (to stack)          @name
  restore value of                  !name
  store into                        name!
  fetch from                        name@

I don't understand when it's appropriate to use @name or !name, and
when to use name@ or name!.

My research so far: The Standard use the latter a lot: C!, 2! R@, F!,
DEFER@, etc.  But the former seems to be rare.  I found !CSP and !BITS
in some traditional Forths.  Machine Forth use A!/A@ to access the
contents of the A register, and !A/@A to access memory.

Any insights?

[toc] | [next] | [standalone]


#45437

FromMark Wills <markwills1970@gmail.com>
Date2016-02-11 01:56 -0800
Message-ID<43ec31de-784d-46de-b07d-7db5c732c37e@googlegroups.com>
In reply to#45436
On Thursday, 11 February 2016 09:16:58 UTC, Lars Brinkhoff  wrote:
> Leo Brodie's Forth style guide says:
> 
>   save value of (to stack)          @name
>   restore value of                  !name
>   store into                        name!
>   fetch from                        name@
> 
> I don't understand when it's appropriate to use @name or !name, and
> when to use name@ or name!.
> 
> My research so far: The Standard use the latter a lot: C!, 2! R@, F!,
> DEFER@, etc.  But the former seems to be rare.  I found !CSP and !BITS
> in some traditional Forths.  Machine Forth use A!/A@ to access the
> contents of the A register, and !A/@A to access memory.
> 
> Any insights?

I have used the following conventions:

to the stack: @thing ("fetch thing" - from thing to the stack)
from the stack: !thing ("store thing" - from the stack to thing)

But, equally, you could use:

thing> ("fetch thing" - from thing to the stack)
>thing ("store thing" - from the stack to thing)

I've used both, and don't really have a preference.

You pay's your money and makes your choice ;-)

[toc] | [prev] | [next] | [standalone]


#45443

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2016-02-11 12:04 +0100
Message-ID<861t8jzex1.fsf@molnjunk.nocrew.org>
In reply to#45437
Mark Wills wrote:
> Lars Brinkhoff wrote:
>>   save value of (to stack)          @name
>>   restore value of                  !name
>>   store into                        name!
>>   fetch from                        name@
>> 
>> I don't understand when it's appropriate to use @name or !name, and
>> when to use name@ or name!.
>
> I have used the following conventions:
>
> to the stack: @thing ("fetch thing" - from thing to the stack)
> from the stack: !thing ("store thing" - from the stack to thing)

So what's your take on name! and name@?

Maybe the convention is <DATA-TYPE>!/@, and !/@<ENTITY>?

(In which case one might argue that R@ should have been named @R
instead.)

> But, equally, you could use:
>
> thing> ("fetch thing" - from thing to the stack)
> >thing ("store thing" - from the stack to thing)

Right, like R> and >R.

[toc] | [prev] | [next] | [standalone]


#45509

From"HAA" <someone@microsoft.com>
Date2016-02-14 09:28 +1100
Message-ID<n9oand$3dt$1@gioia.aioe.org>
In reply to#45437
Mark Wills wrote:
> ...
> I have used the following conventions:
>
> to the stack: @thing ("fetch thing" - from thing to the stack)
> from the stack: !thing ("store thing" - from the stack to thing)
> ...

That appears to be it.  Checking SwiftForth I found:

    @DATE ( -- n )
    !DATE ( n -- )

    @TIME ( -- ud )
    !TIME ( ud -- )

These fetch/store values to the system.


[toc] | [prev] | [next] | [standalone]


#45515

Fromhughaguilar96@gmail.com
Date2016-02-13 21:45 -0800
Message-ID<55c0a8f0-462d-4550-962e-1095289f6484@googlegroups.com>
In reply to#45509
On Saturday, February 13, 2016 at 3:29:15 PM UTC-7, HAA wrote:
> Mark Wills wrote:
> > ...
> > I have used the following conventions:
> >
> > to the stack: @thing ("fetch thing" - from thing to the stack)
> > from the stack: !thing ("store thing" - from the stack to thing)
> > ...
> 
> That appears to be it.  Checking SwiftForth I found:
> 
>     @DATE ( -- n )
>     !DATE ( n -- )
> 
>     @TIME ( -- ud )
>     !TIME ( ud -- )
> 
> These fetch/store values to the system.

This naming convention was obsolete in the 1980s. It comes from very early 1970s Forth implementations written at a time when naming conventions hadn't yet been settled.

You should always have xxx@ and xxx! that do the same as xxx @ and xxx ! --- Forth is postfix, after all.

[toc] | [prev] | [next] | [standalone]


#45438

FromRod Pemberton <NoHaveNotOne@bcczxcfre.cmm>
Date2016-02-11 05:02 -0500
Message-ID<20160211050207.09f4d18c@_>
In reply to#45436
On Thu, 11 Feb 2016 10:01:25 +0100
Lars Brinkhoff <lars.spam@nocrew.org> wrote:

> Leo Brodie's Forth style guide says:
> 
>   save value of (to stack)          @name
>   restore value of                  !name
>   store into                        name!
>   fetch from                        name@
> 
> I don't understand when it's appropriate to use @name or !name, and
> when to use name@ or name!.
> 
> My research so far: The Standard use the latter a lot: C!, 2! R@, F!,
> DEFER@, etc.  But the former seems to be rare.  I found !CSP and !BITS
> in some traditional Forths.  Machine Forth use A!/A@ to access the
> contents of the A register, and !A/@A to access memory.
> 
> Any insights?


Leo Brodie's "Thinking Forth" pg 287

Meaning            Form    Example
...
save value of      @name   @CURSOR
restore value of   !name   !CURSOR
store into         name!   SECONDS!
fetch from         name@   INDEX@
...

From that, my guess is that if the source
is the data stack and destination is a variable,
then the @ and ! come after and vice-versa.
I.e., @name and !name are expected to be paired
operations and so are name! and name@.

a) variable -> data stack -> variable
b) data stack -> variable -> data stack

Of course, as you can see they are equivalent.
It's just a matter of the the expected source.


Rod Pemberton

[toc] | [prev] | [next] | [standalone]


#45440

Fromlehs <skydda.barnen@gmail.com>
Date2016-02-11 02:40 -0800
Message-ID<3a23ff9d-83b9-4885-8fa3-dc10cf42141b@googlegroups.com>
In reply to#45436
Den torsdag 11 februari 2016 kl. 10:16:58 UTC+1 skrev Lars Brinkhoff:
> Leo Brodie's Forth style guide says:
> 
>   save value of (to stack)          @name
>   restore value of                  !name
>   store into                        name!
>   fetch from                        name@
> 
> I don't understand when it's appropriate to use @name or !name, and
> when to use name@ or name!.
> 
> My research so far: The Standard use the latter a lot: C!, 2! R@, F!,
> DEFER@, etc.  But the former seems to be rare.  I found !CSP and !BITS
> in some traditional Forths.  Machine Forth use A!/A@ to access the
> contents of the A register, and !A/@A to access memory.
> 
> Any insights?

Can there be a standard about this? There are som many different kind of words that might fit in to use ! and @. In the embryo of ZET,

https://github.com/Lehs/ZET

my Forth based, Gap inspired, mini environment for computational mathematics, I use @ as a prefix to words that acts on addresses, in the sense "fetch and act", i.e:

@split \ ad -- 

that splits the list at the top of a stack allocated at ad, into "tail" and "head" on that stack. While the word

xst@ \ -- n

read the value (without pop the stack) of the xst-stack. I also have a word

stack@ \ ad -- n

where

: xst@ xst stack@ ;

which maybe should be named @stack@ if I was consequent. But being consequent is difficult and could become an obstacle for the programmer. Inconsequence, on the other side, is an obstacle for others to read the code.

For me it's a problem having too much lateral thinking beside. If I would create something very special, I might reform the names as a finishing touch.

[toc] | [prev] | [next] | [standalone]


#45444

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2016-02-11 12:10 +0100
Message-ID<86vb5vy01w.fsf@molnjunk.nocrew.org>
In reply to#45440
lehs wrote:
> Can there be a standard about this?

May be not.  It's not very important, but I was curious because
obviously Leo Brodie cared enough to put it in words and print it in a
book.

> I use @ as a prefix to words that acts on addresses, in the sense
> "fetch and act", i.e:
>
> @split \ ad -- 
>
> that splits the list at the top of a stack allocated at ad, into
> "tail" and "head" on that stack. While the word
>
> xst@ \ -- n
>
> read the value (without pop the stack) of the xst-stack.

I'm not sure (or I wouldn't have started this thread), but isn't this
the exact opposite of Leo Brodie's conventions?

[toc] | [prev] | [next] | [standalone]


#45446

Fromlehs <skydda.barnen@gmail.com>
Date2016-02-11 03:37 -0800
Message-ID<c3d1256d-55c3-4d43-9c7a-53b2723dd02b@googlegroups.com>
In reply to#45444
Den torsdag 11 februari 2016 kl. 12:10:53 UTC+1 skrev Lars Brinkhoff:
> lehs wrote:
> > Can there be a standard about this?
> 
> May be not.  It's not very important, but I was curious because
> obviously Leo Brodie cared enough to put it in words and print it in a
> book.
> 
> > I use @ as a prefix to words that acts on addresses, in the sense
> > "fetch and act", i.e:
> >
> > @split \ ad -- 
> >
> > that splits the list at the top of a stack allocated at ad, into
> > "tail" and "head" on that stack. While the word
> >
> > xst@ \ -- n
> >
> > read the value (without pop the stack) of the xst-stack.
> 
> I'm not sure (or I wouldn't have started this thread), but isn't this
> the exact opposite of Leo Brodie's conventions?

I don't know either and I haven't red the book. Obviously standards are obstacles that oppresses creativity and I guess that's why I stopped read Forth books after a while. And I don't understand Brodie here. What's the difference between "save value of (to stack)" and "fetch from" (to stack?

[toc] | [prev] | [next] | [standalone]


#45449

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2016-02-11 13:04 +0100
Message-ID<86mvr7xxjo.fsf@molnjunk.nocrew.org>
In reply to#45446
Lehs wrote:
> Obviously standards are obstacles that oppresses creativity

Sure, by all means use your own conventions!

> And I don't understand Brodie here. What's the difference between
> "save value of (to stack)" and "fetch from" (to stack?

Right!  That's exactly what I don't understand.

But I think your point about "operating on an address" may be the
answer.

TYPE@ ( addr -- xi ) \ Fetch xi from TYPE at addr.
TYPE! ( xi addr -- ) \ Store xi into TYPE at addr.

@ENTITY ( -- xi ) \ Fetch xi from ENTITY.
!ENTITY ( xi -- ) \ Store xi into ENTITY.

If this isn't what Brodie meant, maybe it ought to be. ;-)

[toc] | [prev] | [next] | [standalone]


#45442

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2016-02-11 10:51 +0000
Message-ID<2016Feb11.115159@mips.complang.tuwien.ac.at>
In reply to#45436
Lars Brinkhoff <lars.spam@nocrew.org> writes:
>Leo Brodie's Forth style guide says:
>
>  save value of (to stack)          @name
>  restore value of                  !name
>  store into                        name!
>  fetch from                        name@
>
>I don't understand when it's appropriate to use @name or !name, and
>when to use name@ or name!.
>
>My research so far: The Standard use the latter a lot: C!, 2! R@, F!,
>DEFER@, etc.  But the former seems to be rare.  I found !CSP and !BITS
>in some traditional Forths.  Machine Forth use A!/A@ to access the
>contents of the A register, and !A/@A to access memory.
>
>Any insights?

The guide you cite above is at odds with the practice in the standard
and elsewhere.  The practice I have experienced is to use the type as
prefix (c@ d@ f@), and to use postfixes for variants; e.g., if you
want to have an unaligned load, you might have @u d@u f@u.

- 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 2015: http://www.rigwit.co.uk/EuroForth2015/

[toc] | [prev] | [next] | [standalone]


#45445

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2016-02-11 12:33 +0100
Message-ID<86r3gjxyzm.fsf@molnjunk.nocrew.org>
In reply to#45442
Anton Ertl writes:
> The guide you cite above is at odds with the practice in the standard
> and elsewhere.  The practice I have experienced is to use the type as
> prefix (c@ d@ f@), and to use postfixes for variants; e.g., if you
> want to have an unaligned load, you might have @u d@u f@u.

I'm may well be out of date, because I guess it's more than 30 years
old.  Maybe it originated at Forth Inc during the 70ies?

Regarding your experience, what do you think about !/@NAME?  (Seen in the
wild: !/@BITS and !/@CSP.)

[toc] | [prev] | [next] | [standalone]


#45448

FromCoos Haak <chforth@hccnet.nl>
Date2016-02-11 13:01 +0100
Message-ID<kbivz6ul22f7.6c7yhs11gox7$.dlg@40tude.net>
In reply to#45445
Op Thu, 11 Feb 2016 12:33:49 +0100 schreef Lars Brinkhoff:

> Anton Ertl writes:
>> The guide you cite above is at odds with the practice in the standard
>> and elsewhere.  The practice I have experienced is to use the type as
>> prefix (c@ d@ f@), and to use postfixes for variants; e.g., if you
>> want to have an unaligned load, you might have @u d@u f@u.
> 
> I'm may well be out of date, because I guess it's more than 30 years
> old.  Maybe it originated at Forth Inc during the 70ies?

Forth Inc. did not even exist then. I've read somewhere B@ and B!
for C@ and C!
D@ and D! are mostly written as 2@ and 2!

> 
> Regarding your experience, what do you think about !/@NAME?  (Seen in the
> wild: !/@BITS and !/@CSP.)

Store and fetch in one name? What do they do?

!CSP has no arguments and no results, so it's quite different from
those above. It does not match with @CSP (unknown) but with ?CSP.
Also neither arguments or results.

groet Coos

[toc] | [prev] | [next] | [standalone]


#45450

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2016-02-11 13:11 +0100
Message-ID<86io1vxx91.fsf@molnjunk.nocrew.org>
In reply to#45448
Coos Haak skrev:
> Lars Brinkhoff schreef:
>> Maybe it originated at Forth Inc during the 70ies?
> Forth Inc. did not even exist then.

It was formed 1973 according to the intertubes.

>> Regarding your experience, what do you think about !/@NAME?
> Store and fetch in one name? What do they do?

I dunno, that's kinda what the thread is about.  Access a named thing?

> !CSP has no arguments and no results, so it's quite different from
> those above. It does not match with @CSP (unknown) but with ?CSP.

Point taken on ?CSP.

I think !CSP could be read as "store something into CSP".  (Which is
what is does, yay!)  In this case "something" isn't from the stack.
I.e. the stack effext is ( xi -- ) with i=0.

But it's not a strong argument.

[toc] | [prev] | [next] | [standalone]


#45458

FromAlbert van der Horst <albert@spenarnc.xs4all.nl>
Date2016-02-11 13:30 +0000
Message-ID<56bc8ce7$0$23831$e4fe514c@news.xs4all.nl>
In reply to#45448
Coos Haak <chforth@hccnet.nl> writes:

>Op Thu, 11 Feb 2016 12:33:49 +0100 schreef Lars Brinkhoff:

>> Anton Ertl writes:
>>> The guide you cite above is at odds with the practice in the standard
>>> and elsewhere.  The practice I have experienced is to use the type as
>>> prefix (c@ d@ f@), and to use postfixes for variants; e.g., if you
>>> want to have an unaligned load, you might have @u d@u f@u.
>>
>> I'm may well be out of date, because I guess it's more than 30 years
>> old.  Maybe it originated at Forth Inc during the 70ies?

>Forth Inc. did not even exist then. I've read somewhere B@ and B!
>for C@ and C!
>D@ and D! are mostly written as 2@ and 2!

>>
>> Regarding your experience, what do you think about !/@NAME?  (Seen in the
>> wild: !/@BITS and !/@CSP.)

>Store and fetch in one name? What do they do?

>!CSP has no arguments and no results, so it's quite different from
>those above. It does not match with @CSP (unknown) but with ?CSP.
>Also neither arguments or results.

That usage is consistent with what I mentionned in my other post:
    !CSP : initialise the stack checking mechanism (with the current
            value of the stack pointer)

>groet Coos
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#45451

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2016-02-11 12:15 +0000
Message-ID<2016Feb11.131512@mips.complang.tuwien.ac.at>
In reply to#45445
Lars Brinkhoff <lars.spam@nocrew.org> writes:
>Anton Ertl writes:
>> The guide you cite above is at odds with the practice in the standard
>> and elsewhere.  The practice I have experienced is to use the type as
>> prefix (c@ d@ f@), and to use postfixes for variants; e.g., if you
>> want to have an unaligned load, you might have @u d@u f@u.
>
>I'm may well be out of date, because I guess it's more than 30 years
>old.  Maybe it originated at Forth Inc during the 70ies?
>
>Regarding your experience, what do you think about !/@NAME?  (Seen in the
>wild: !/@BITS and !/@CSP.)

!CSP in fig-Forth stores the stack depth in the user variable CSP.
There is no @CSP, only ?CSP which checks the depth against the old
depth.

- 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 2015: http://www.rigwit.co.uk/EuroForth2015/

[toc] | [prev] | [next] | [standalone]


#45453

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2016-02-11 13:35 +0100
Message-ID<86egcjxw5m.fsf@molnjunk.nocrew.org>
In reply to#45451
Anton wrote:
> > Regarding your experience, what do you think about !/@NAME?  (Seen
> > in the wild: !/@BITS and !/@CSP.)
>
> !CSP in fig-Forth stores the stack depth in the user variable CSP.
> There is no @CSP, only ?CSP which checks the depth against the old
> depth.

Yes, I understand.  Do you have any thoughts about Brodie's style guide
regarding !NAME and @NAME?

[toc] | [prev] | [next] | [standalone]


#45454

FromMark Wills <markwills1970@gmail.com>
Date2016-02-11 05:06 -0800
Message-ID<56ee567c-4a52-4ff6-afa4-5a63eebd1f3e@googlegroups.com>
In reply to#45453
On Thursday, 11 February 2016 12:35:05 UTC, Lars Brinkhoff  wrote:
> Anton wrote:
> > > Regarding your experience, what do you think about !/@NAME?  (Seen
> > > in the wild: !/@BITS and !/@CSP.)
> >
> > !CSP in fig-Forth stores the stack depth in the user variable CSP.
> > There is no @CSP, only ?CSP which checks the depth against the old
> > depth.
> 
> Yes, I understand.  Do you have any thoughts about Brodie's style guide
> regarding !NAME and @NAME?

On reflection, I think I prefer the >thing and thing> approach. It
seems less ambiguous.

[toc] | [prev] | [next] | [standalone]


#45455

FromChris Curl <ccurl609@gmail.com>
Date2016-02-11 05:18 -0800
Message-ID<aebf537b-13c1-4a57-9079-46be82eac58f@googlegroups.com>
In reply to#45454
On Thursday, February 11, 2016 at 8:06:02 AM UTC-5, Mark Wills wrote:
> 
> On reflection, I think I prefer the >thing and thing> approach. It
> seems less ambiguous.

The is my preference as well.

[toc] | [prev] | [next] | [standalone]


#45457

FromAlbert van der Horst <albert@spenarnc.xs4all.nl>
Date2016-02-11 13:27 +0000
Message-ID<56bc8c2b$0$23831$e4fe514c@news.xs4all.nl>
In reply to#45442
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:

>Lars Brinkhoff <lars.spam@nocrew.org> writes:
>>Leo Brodie's Forth style guide says:
>>
>>  save value of (to stack)          @name
>>  restore value of                  !name
>>  store into                        name!
>>  fetch from                        name@
>>
>>I don't understand when it's appropriate to use @name or !name, and
>>when to use name@ or name!.
>>
>>My research so far: The Standard use the latter a lot: C!, 2! R@, F!,
>>DEFER@, etc.  But the former seems to be rare.  I found !CSP and !BITS
>>in some traditional Forths.  Machine Forth use A!/A@ to access the
>>contents of the A register, and !A/@A to access memory.
>>
>>Any insights?

>The guide you cite above is at odds with the practice in the standard
>and elsewhere.  The practice I have experienced is to use the type as
>prefix (c@ d@ f@), and to use postfixes for variants; e.g., if you
>want to have an unaligned load, you might have @u d@u f@u.

Then there is the use of !<x> where <x> is some datastructure
to denote initialisation.

    100 BAG key-notes

    key-notes !BAG          \ Make bag empty.

I'm so thoroughly familiar with this, that I know no better than
that it is is existing practice.

>- anton
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.forth


csiph-web