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 7 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 2 of 2 — ← Prev page 1 [2]


#45452

Fromstephen@mpeforth.com (Stephen Pelc)
Date2016-02-11 12:35 +0000
Message-ID<56bc7e81.31133135@news.eternal-september.org>
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!.

The last memory access wordset proposal for Forth-200x contains the 
following item 2. It's a convention, but the people around the table
can live with it. Treat <size> below as meaning <what>. 

What is before the @ or ! tells you what the data item is, the prefix
BE or LE can tell you how the item is used/stored/fetched, and what
comes after@ or ! tells you which address space or channel is being
used.

2. The names follow the notation:

        [<order> -] <size> <action> [<address-space>]

    where:

        order:   BE for big endian
                 LE for little endian
        size:    B for 8-bit byte
                 W for 16-bit word
                 L for 32-bit long-word
                 X for 64-bit extended-word
        action:  !, @ or , with the usual meaning

   Systems with multiple address spaces, e.g. Harvard architectures
   and cross compilers often require an address-space indicator:

        address space:
                 C code space
                 R register space
                 T target address space in cross compiler
                 D Debug link

   The default byte order (<order>) is the native byte order for
   the implementation unless otherwise indicated.  The default
   address-space (<address-space>) is the data space.

Stephen

-- 
Stephen Pelc, stephenXXX@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

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


#45468

From"HAA" <someone@microsoft.com>
Date2016-02-12 16:58 +1100
Message-ID<n9js8r$sst$1@gioia.aioe.org>
In reply to#45436
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!.

Based on usage I've seen

name@  ( -- x )   name!  ( x -- )  are simply shorthand versions of
name @  and  name  !  respectively where  name  is an existing variable.

!name ( -- )  is synonymous with  /name  i.e. it resets variable  name
to its default value.

I don't recall seeing  @name  used so I won't speculate what it does.
Elizabeth would probably know.


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


#45470

From"HAA" <someone@microsoft.com>
Date2016-02-12 17:41 +1100
Message-ID<n9jupf$vqn$1@gioia.aioe.org>
In reply to#45468
HAA wrote:
> ...
> !name ( -- )  is synonymous with  /name  i.e. it resets variable  name
> to its default value.

Looking at Brodie's list I see the above is at odds with his so beware.

Given his examples  @name  !name  usage is likely to be:

!cursor ( -- )    save the current console cursor position (presumably
                        in a 2variable called CURSOR)

@cursor ( -- )  restore the console cursor position previously saved by
                        !cursor


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


#45476

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2016-02-12 08:56 +0100
Message-ID<86h9heweej.fsf@molnjunk.nocrew.org>
In reply to#45470
HAA wrote:
> Looking at Brodie's list I see the above is at odds with his so beware.

Aren't every Forther slightly at odds with everyone else? ;-)

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


#45472

FromLars Brinkhoff <lars.spam@nocrew.org>
Date2016-02-12 08:13 +0100
Message-ID<86wpqawgdz.fsf@molnjunk.nocrew.org>
In reply to#45468
HAA wrote:
> !name ( -- ) is synonymous with /name i.e. it resets variable name to
> its default value.

Curious, I've usually seen /NAME used as "(bytes) per NAME", i.e. "size
of NAME".

For resetting something, I've seen "0NAME", i.e. "zero/clear the state
of NAME".

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


#45485

From"HAA" <someone@microsoft.com>
Date2016-02-13 01:36 +1100
Message-ID<n9kqmb$su8$1@gioia.aioe.org>
In reply to#45472
Lars Brinkhoff wrote:
> HAA wrote:
> > !name ( -- ) is synonymous with /name i.e. it resets variable name to
> > its default value.
>
> Curious, I've usually seen /NAME used as "(bytes) per NAME", i.e. "size
> of NAME".
>
> For resetting something, I've seen "0NAME", i.e. "zero/clear the state
> of NAME".

A reduced list appears in Forth Programmers Handbook (included with
SwiftForth demo).  There  /name  is listed as meaning either division,
initialize, or "per".



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


#45488

FromCoos Haak <chforth@hccnet.nl>
Date2016-02-12 22:46 +0100
Message-ID<11e0d0m3zfnkf.1p9v3swl0r2he$.dlg@40tude.net>
In reply to#45485
Op Sat, 13 Feb 2016 01:36:50 +1100 schreef HAA:

> Lars Brinkhoff wrote:
>> HAA wrote:
>>> !name ( -- ) is synonymous with /name i.e. it resets variable name to
>>> its default value.
>>
>> Curious, I've usually seen /NAME used as "(bytes) per NAME", i.e. "size
>> of NAME".
>>
>> For resetting something, I've seen "0NAME", i.e. "zero/clear the state
>> of NAME".
> 
> A reduced list appears in Forth Programmers Handbook (included with
> SwiftForth demo).  There  /name  is listed as meaning either division,
> initialize, or "per".

I use / in names for division and "per" a lot. I haven't encountered
initializing though.
Another common one but diffrerent is /STRING

groet Coos

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

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


csiph-web