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


Groups > comp.lang.forth > #45438

Re: NAME! and NAME@ versus !NAME and @NAME

Path csiph.com!aioe.org!.POSTED!not-for-mail
From Rod Pemberton <NoHaveNotOne@bcczxcfre.cmm>
Newsgroups comp.lang.forth
Subject Re: NAME! and NAME@ versus !NAME and @NAME
Date Thu, 11 Feb 2016 05:02:07 -0500
Organization Aioe.org NNTP Server
Lines 46
Message-ID <20160211050207.09f4d18c@_> (permalink)
References <8660xvzkm2.fsf@molnjunk.nocrew.org>
NNTP-Posting-Host n4wpt9zq8xR26Ttf9mo2BA.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding quoted-printable
X-Complaints-To abuse@aioe.org
X-Notice Filtered by postfilter v. 0.8.2
X-Newsreader Claws Mail 3.13.1 (GTK+ 2.24.10; x86_64-unknown-linux-gnu)
Xref csiph.com comp.lang.forth:45438

Show key headers only | View raw


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

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web