Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

If the facts don't fit the theory, change the facts. -- Albert Einstein


devel / comp.lang.forth / Re: evil stack words

SubjectAuthor
* evil stack wordsPaul Rubin
+* Re: evil stack wordsdxforth
|+- Re: evil stack wordsRon AARON
|`* Re: evil stack wordsAnton Ertl
| `* Re: evil stack wordsdxforth
|  `* Re: evil stack wordsPaul Rubin
|   `- Re: evil stack wordsdxforth
+* Re: evil stack wordsGerry Jackson
|+- Re: evil stack wordsAnton Ertl
|`* Re: evil stack wordsPaul Rubin
| +* Re: evil stack wordsdxforth
| |`* Re: evil stack wordsPaul Rubin
| | +- Re: evil stack wordsdxforth
| | +* Re: evil stack wordsRick C
| | |`* Re: evil stack wordsGerry Jackson
| | | +* Re: evil stack wordsminf...@arcor.de
| | | |`* Re: evil stack wordsdxforth
| | | | `- Re: evil stack wordsminf...@arcor.de
| | | `* Re: evil stack wordsRick C
| | |  `- Re: evil stack wordsGerry Jackson
| | `- Re: evil stack wordsAnton Ertl
| +- Re: evil stack wordsGerry Jackson
| `- Re: evil stack wordsAnton Ertl
`- Re: evil stack wordsAnton Ertl

1
evil stack words

<87k0g71q7o.fsf@nightsong.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15548&group=comp.lang.forth#15548

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: evil stack words
Date: Tue, 14 Dec 2021 01:38:19 -0800
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <87k0g71q7o.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="106f99cd0e8ff52781a5292cc9e6939f";
logging-data="29882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lb502khtPXTBZAMe/260g"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:qYX8E3ZouRLLctbJA/nsRjodO4o=
sha1:DLoh41T8+0bAj0ymZATksHrE9Es=
 by: Paul Rubin - Tue, 14 Dec 2021 09:38 UTC

Is there a reasonably widespread word that is the opposite of ROLL,
i.e. something like -ROLL or ROLL doing the equivalent thing when given
a negative argument? That is, roll "up" rather than rolling down,
analogously with -ROT vs ROT. I notice that in Gforth, ROLL with
negative argument does nothing.

Similarly, is there a word like PLACE or UNPICK, that does the opposite
of PICK? That is, jam a value into the interior of the stack,
overwriting what was there before.

Of course I realize these are evil, especially UNPICK/PLACE in
handwritten code, but they might be useable in low level implementation
or in machine generated code. They are not totally illegitimate, since
gforth and many other implementations have SP@, SP! and related which
can be used that way.

It occurs to me that if PICK and ROLL are primitives, the usual stack
words can be derived (untested):

: DUP ( x -- x x ) 0 PICK ;
: OVER ( x y -- x y x ) 1 PICK ;
: SWAP ( x y -- y x ) 1 ROLL ;
: ROT ( x y z -- y z x ) 2 ROLL ;
: -ROT ( x y z -- z x y ) -2 ROLL ; \ this doesn't exist!

and maybe a few others.

Re: evil stack words

<sp9pkt$1jj5$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15549&group=comp.lang.forth#15549

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Tue, 14 Dec 2021 20:54:37 +1100
Organization: Aioe.org NNTP Server
Message-ID: <sp9pkt$1jj5$1@gioia.aioe.org>
References: <87k0g71q7o.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="52837"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Tue, 14 Dec 2021 09:54 UTC

On 14/12/2021 20:38, Paul Rubin wrote:
> Is there a reasonably widespread word that is the opposite of ROLL,
> i.e. something like -ROLL or ROLL doing the equivalent thing when given
> a negative argument? That is, roll "up" rather than rolling down,
> analogously with -ROT vs ROT. I notice that in Gforth, ROLL with
> negative argument does nothing.
> ...

Swiftforth has -ROLL as do I. I used it for control stack manipulation
where speed was of no consequence:

http://dxforth.mirrors.minimaltype.com/cfsext.html

Re: evil stack words

<sp9tsf$4ds$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15551&group=comp.lang.forth#15551

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: clf...@8th-dev.com (Ron AARON)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Tue, 14 Dec 2021 13:06:55 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <sp9tsf$4ds$1@dont-email.me>
References: <87k0g71q7o.fsf@nightsong.com> <sp9pkt$1jj5$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 14 Dec 2021 11:06:55 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="ae441f7e62af4e743065f84833d6bede";
logging-data="4540"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18NT2TaI6hLoyPNkKWSCB8p"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.4.0
Cancel-Lock: sha1:oNaz3iihLmeP72CNfLQoL7cE+Ms=
In-Reply-To: <sp9pkt$1jj5$1@gioia.aioe.org>
Content-Language: en-US
 by: Ron AARON - Tue, 14 Dec 2021 11:06 UTC

On 2021-12-14 11:54, dxforth wrote:
> On 14/12/2021 20:38, Paul Rubin wrote:
>> Is there a reasonably widespread word that is the opposite of ROLL,
>> i.e. something like -ROLL or ROLL doing the equivalent thing when given
>> a negative argument?  That is, roll "up" rather than rolling down,
>> analogously with -ROT vs ROT.  I notice that in Gforth, ROLL with
>> negative argument does nothing.
>> ...
>
> Swiftforth has -ROLL as do I.  I used it for control stack manipulation
> where speed was of no consequence:
>
> http://dxforth.mirrors.minimaltype.com/cfsext.html

In 8th, a negative offset value to 'roll' has the effect you're describing.

Re: evil stack words

<7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15556&group=comp.lang.forth#15556

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:1c41:: with SMTP id if1mr5867682qvb.0.1639494572854;
Tue, 14 Dec 2021 07:09:32 -0800 (PST)
X-Received: by 2002:ac8:5b8c:: with SMTP id a12mr6507997qta.353.1639494572688;
Tue, 14 Dec 2021 07:09:32 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Tue, 14 Dec 2021 07:09:32 -0800 (PST)
In-Reply-To: <87k0g71q7o.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=86.189.249.45; posting-account=dZP_5goAAAC_BO-SX5ENBfo71Ro3Vnig
NNTP-Posting-Host: 86.189.249.45
References: <87k0g71q7o.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
Subject: Re: evil stack words
From: gwj.ne...@gmail.com (Gerry Jackson)
Injection-Date: Tue, 14 Dec 2021 15:09:32 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 40
 by: Gerry Jackson - Tue, 14 Dec 2021 15:09 UTC

On Tuesday, December 14, 2021 at 9:38:21 AM UTC, Paul Rubin wrote:
> Is there a reasonably widespread word that is the opposite of ROLL,
> i.e. something like -ROLL or ROLL doing the equivalent thing when given
> a negative argument? That is, roll "up" rather than rolling down,
> analogously with -ROT vs ROT. I notice that in Gforth, ROLL with
> negative argument does nothing.
>
> Similarly, is there a word like PLACE or UNPICK, that does the opposite
> of PICK? That is, jam a value into the interior of the stack,
> overwriting what was there before.
>
> Of course I realize these are evil, especially UNPICK/PLACE in
> handwritten code, but they might be useable in low level implementation
> or in machine generated code. They are not totally illegitimate, since
> gforth and many other implementations have SP@, SP! and related which
> can be used that way.
>
> It occurs to me that if PICK and ROLL are primitives, the usual stack
> words can be derived (untested):
>
> : DUP ( x -- x x ) 0 PICK ;
> : OVER ( x y -- x y x ) 1 PICK ;
> : SWAP ( x y -- y x ) 1 ROLL ;
> : ROT ( x y z -- y z x ) 2 ROLL ;
> : -ROT ( x y z -- z x y ) -2 ROLL ; \ this doesn't exist!
>
> and maybe a few others.
A few years ago I define -ROLL as

: -roll ( xu ... x0 u -- x0 xu ... x1 )
?dup if rot >r 1- recurse r> then
; Also STICK (which GForth also has) which you've called UNPICK. I can't find my definition but GForth's is:

see stick
: stick
2 + cells sp@ + ! ; ok

--
Gerry

Re: evil stack words

<2021Dec14.182620@mips.complang.tuwien.ac.at>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15557&group=comp.lang.forth#15557

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Tue, 14 Dec 2021 17:26:20 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 50
Message-ID: <2021Dec14.182620@mips.complang.tuwien.ac.at>
References: <87k0g71q7o.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="ffd9b30198c8f50fa1d6fd5ca98f36ab";
logging-data="16425"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Qa7f19R6yZyYysYB+KjGz"
Cancel-Lock: sha1:LLwqPrC/cJxShGG3XFh0xvX0n2c=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Tue, 14 Dec 2021 17:26 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>Similarly, is there a word like PLACE or UNPICK, that does the opposite
>of PICK? That is, jam a value into the interior of the stack,
>overwriting what was there before.

Tevet's named stack items were implemented using such a word, and he
called it STICK. In a message by Andrew Haley from 2013 he called
that word POKE.

>They are not totally illegitimate, since
>gforth and many other implementations have SP@, SP! and related which
>can be used that way.

SP@ in Gforth gives you less than you may think, because Gforth can
keep stack items in registers. SP@ stores all stack items in memory
at the start, so you can implement PICK with SP@, but for STICK I
don't see a way that's guaranteed to work.

>It occurs to me that if PICK and ROLL are primitives, the usual stack
>words can be derived (untested):
>
> : DUP ( x -- x x ) 0 PICK ;
> : OVER ( x y -- x y x ) 1 PICK ;

Let's see:

: DUP ( x -- x x ) 0 PICK ;
*terminal*:1:29: warning: redefined dup with DUP
prim:1578:1: warning: original location ok
: OVER ( x y -- x y x ) 1 PICK ;
*terminal*:2:34: warning: redefined over with OVER
prim:1564:1: warning: original location ok
see dup
: DUP
dup ; ok
see over
: OVER
over ; ok

What happens here is that the constant folder optimizes 0 PICK into
DUP and 1 PICK into OVER.

We don't optimize ROLL in the same way.

- 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 2021: https://euro.theforth.net/2021

Re: evil stack words

<2021Dec14.184417@mips.complang.tuwien.ac.at>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15558&group=comp.lang.forth#15558

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Tue, 14 Dec 2021 17:44:17 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 18
Message-ID: <2021Dec14.184417@mips.complang.tuwien.ac.at>
References: <87k0g71q7o.fsf@nightsong.com> <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="ffd9b30198c8f50fa1d6fd5ca98f36ab";
logging-data="16425"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1957uf/4xf71ra3pKqyeImX"
Cancel-Lock: sha1:OYhT5j2g6atwHfcGH1asJkql3vk=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Tue, 14 Dec 2021 17:44 UTC

Gerry Jackson <gwj.nexus@gmail.com> writes:
>GForth's is:
>
>see stick
>: stick
> 2 + cells sp@ + ! ; ok

Elsewhere I write that this definition is not guaranteed to work. But
I can play the system implementor's card: I can either ensure that the
system below works such that STICK works, or change the definition of
STICK when this one no longer works.

- 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 2021: https://euro.theforth.net/2021

Re: evil stack words

<87fsqv127n.fsf@nightsong.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15559&group=comp.lang.forth#15559

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Tue, 14 Dec 2021 10:16:44 -0800
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <87fsqv127n.fsf@nightsong.com>
References: <87k0g71q7o.fsf@nightsong.com>
<7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="106f99cd0e8ff52781a5292cc9e6939f";
logging-data="30993"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18BAizSnM4eC+keXOV9AX/7"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:Q/MmVeHcvK3bLeScUSvSTyXb2UY=
sha1:jaLjNOpRBRhL7dvgOrHoT7FrtlA=
 by: Paul Rubin - Tue, 14 Dec 2021 18:16 UTC

Gerry Jackson <gwj.nexus@gmail.com> writes:
> Also STICK (which GForth also has) which you've called UNPICK. I can't
> find my definition but GForth's is:
>
> see stick
> : stick
> 2 + cells sp@ + ! ; ok

Gforth 0.7.3 doesn't seem to have this, and it's not in the online docs
at http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ . Still,
it's interesting. I had expected an angry response to the question of
whether such a thing existed. Instead, it seems to be somewhat accepted.

Re: evil stack words

<spbhj2$1os$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15561&group=comp.lang.forth#15561

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Wed, 15 Dec 2021 12:49:23 +1100
Organization: Aioe.org NNTP Server
Message-ID: <spbhj2$1os$1@gioia.aioe.org>
References: <87k0g71q7o.fsf@nightsong.com>
<7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="1820"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Wed, 15 Dec 2021 01:49 UTC

On 15/12/2021 05:16, Paul Rubin wrote:
> Gerry Jackson <gwj.nexus@gmail.com> writes:
>> Also STICK (which GForth also has) which you've called UNPICK. I can't
>> find my definition but GForth's is:
>>
>> see stick
>> : stick
>> 2 + cells sp@ + ! ; ok
>
> Gforth 0.7.3 doesn't seem to have this, and it's not in the online docs
> at http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ . Still,
> it's interesting. I had expected an angry response to the question of
> whether such a thing existed. Instead, it seems to be somewhat accepted.
>

Accepted? PICK and ROLL are accepted because they had history. -ROLL
had less use - why few systems implement it. STICK (which I'd not heard
of until today) seems to have no precedence. Worth getting angry about?
Only if 200x were to adopt it.

Re: evil stack words

<87bl1i1qgq.fsf@nightsong.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15563&group=comp.lang.forth#15563

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Tue, 14 Dec 2021 19:45:09 -0800
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <87bl1i1qgq.fsf@nightsong.com>
References: <87k0g71q7o.fsf@nightsong.com>
<7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="ca091579974ce49d4acabd5da917bfdb";
logging-data="1923"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Y+gzL1D8HQTiZaOrPt4LD"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:R1Ppi9Yhrujkc+By7Qa1pp2EC8g=
sha1:Lwhhw17OLej5fsTUIYXleeJwd8g=
 by: Paul Rubin - Wed, 15 Dec 2021 03:45 UTC

dxforth <dxforth@gmail.com> writes:
> Accepted? PICK and ROLL are accepted because they had history. -ROLL
> had less use - why few systems implement it. STICK (which I'd not heard
> of until today) seems to have no precedence. Worth getting angry about?
> Only if 200x were to adopt it.

STICK seems like something of a travesty even to me. I thought of it
because of the discussion of stack cpu's. With STICK (at least for
fixed offset) in hardware, the stack cpu can also be used as something
like a register cpu, targeted by a relatively conventional compiler for
infix languages.

ROLL with negative arg (or -ROLL) does seem to me worth standardizing or
at least documenting as optional, if ROLL itself (with nonnegative arg)
is standardized.

Re: evil stack words

<spbs2r$uv2$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15564&group=comp.lang.forth#15564

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Wed, 15 Dec 2021 15:48:28 +1100
Organization: Aioe.org NNTP Server
Message-ID: <spbs2r$uv2$1@gioia.aioe.org>
References: <87k0g71q7o.fsf@nightsong.com>
<7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org>
<87bl1i1qgq.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="31714"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Wed, 15 Dec 2021 04:48 UTC

On 15/12/2021 14:45, Paul Rubin wrote:
> ...
> ROLL with negative arg (or -ROLL) does seem to me worth standardizing or
> at least documenting as optional, if ROLL itself (with nonnegative arg)
> is standardized.

Early implementations of SHIFT (Forth-83 Uncontrolled Reference Words) had
a signed argument. When ANS got around to standardizing it they split it
into two separate words - easier to use and implement. Same would apply
to ROLL.

Re: evil stack words

<91d0614a-b581-44f2-bf3a-bee13fbfeb83n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15565&group=comp.lang.forth#15565

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:4ce:: with SMTP id q14mr10769236qtx.627.1639552571271;
Tue, 14 Dec 2021 23:16:11 -0800 (PST)
X-Received: by 2002:a37:d207:: with SMTP id f7mr7695771qkj.272.1639552571076;
Tue, 14 Dec 2021 23:16:11 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Tue, 14 Dec 2021 23:16:10 -0800 (PST)
In-Reply-To: <87bl1i1qgq.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.137.246.135; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 24.137.246.135
References: <87k0g71q7o.fsf@nightsong.com> <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org> <87bl1i1qgq.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <91d0614a-b581-44f2-bf3a-bee13fbfeb83n@googlegroups.com>
Subject: Re: evil stack words
From: gnuarm.d...@gmail.com (Rick C)
Injection-Date: Wed, 15 Dec 2021 07:16:11 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 34
 by: Rick C - Wed, 15 Dec 2021 07:16 UTC

On Tuesday, December 14, 2021 at 11:45:13 PM UTC-4, Paul Rubin wrote:
> dxforth <dxf...@gmail.com> writes:
> > Accepted? PICK and ROLL are accepted because they had history. -ROLL
> > had less use - why few systems implement it. STICK (which I'd not heard
> > of until today) seems to have no precedence. Worth getting angry about?
> > Only if 200x were to adopt it.
> STICK seems like something of a travesty even to me. I thought of it
> because of the discussion of stack cpu's. With STICK (at least for
> fixed offset) in hardware, the stack cpu can also be used as something
> like a register cpu, targeted by a relatively conventional compiler for
> infix languages.

STICK would be hard to implement in hardware and is NOTHING like accessing registers. STICK requires every word between the insertion point and the top to be copied up. Very messy no matter the implementation. If the stack is implemented as a set of registers, they can be designed specifically to handle operations like this, but it takes significant logic and the registers themselves are more complex than what could be done with a simple stack..

To get anything like a register oriented access in a hardware implementation implies the instruction itself includes the stack offset (i.e. the register address). Trying to do this with operands on the stack makes the design very, very messy unless you like using a lot of clock cycles for the instruction or a lot of logic for the stack.

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Re: evil stack words

<d6bc4f77-62f7-496d-9b7d-7b0fbaab4854n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15566&group=comp.lang.forth#15566

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:b8b:: with SMTP id k11mr7681676qkh.746.1639556346927;
Wed, 15 Dec 2021 00:19:06 -0800 (PST)
X-Received: by 2002:a37:747:: with SMTP id 68mr7724508qkh.227.1639556346710;
Wed, 15 Dec 2021 00:19:06 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 15 Dec 2021 00:19:06 -0800 (PST)
In-Reply-To: <87fsqv127n.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=86.189.249.45; posting-account=dZP_5goAAAC_BO-SX5ENBfo71Ro3Vnig
NNTP-Posting-Host: 86.189.249.45
References: <87k0g71q7o.fsf@nightsong.com> <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d6bc4f77-62f7-496d-9b7d-7b0fbaab4854n@googlegroups.com>
Subject: Re: evil stack words
From: gwj.ne...@gmail.com (Gerry Jackson)
Injection-Date: Wed, 15 Dec 2021 08:19:06 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 18
 by: Gerry Jackson - Wed, 15 Dec 2021 08:19 UTC

On Tuesday, December 14, 2021 at 6:16:47 PM UTC, Paul Rubin wrote:
> Gerry Jackson <gwj....@gmail.com> writes:
> > Also STICK (which GForth also has) which you've called UNPICK. I can't
> > find my definition but GForth's is:
> >
> > see stick
> > : stick
> > 2 + cells sp@ + ! ; ok
> Gforth 0.7.3 doesn't seem to have this, and it's not in the online docs
> at http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ . Still,
> it's interesting. I had expected an angry response to the question of
> whether such a thing existed. Instead, it seems to be somewhat accepted.

One problem with ddeep stack access is the PICK number. Some notes on two
ways to use named constants for the pick number are given in the notes at:
https://github.com/gerryjackson/Forth-sprintf/blob/master/doc/deep-pick.fth

--
Gerry

Re: evil stack words

<86958632-d81a-46ad-a2d8-d727293b030fn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15567&group=comp.lang.forth#15567

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:4a0e:: with SMTP id x14mr10784735qtq.345.1639556720415;
Wed, 15 Dec 2021 00:25:20 -0800 (PST)
X-Received: by 2002:a37:d207:: with SMTP id f7mr7801763qkj.272.1639556720284;
Wed, 15 Dec 2021 00:25:20 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 15 Dec 2021 00:25:20 -0800 (PST)
In-Reply-To: <91d0614a-b581-44f2-bf3a-bee13fbfeb83n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=86.189.249.45; posting-account=dZP_5goAAAC_BO-SX5ENBfo71Ro3Vnig
NNTP-Posting-Host: 86.189.249.45
References: <87k0g71q7o.fsf@nightsong.com> <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org>
<87bl1i1qgq.fsf@nightsong.com> <91d0614a-b581-44f2-bf3a-bee13fbfeb83n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <86958632-d81a-46ad-a2d8-d727293b030fn@googlegroups.com>
Subject: Re: evil stack words
From: gwj.ne...@gmail.com (Gerry Jackson)
Injection-Date: Wed, 15 Dec 2021 08:25:20 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 20
 by: Gerry Jackson - Wed, 15 Dec 2021 08:25 UTC

On Wednesday, December 15, 2021 at 7:16:12 AM UTC, gnuarm.del...@gmail.com wrote:
> On Tuesday, December 14, 2021 at 11:45:13 PM UTC-4, Paul Rubin wrote:
> > dxforth <dxf...@gmail.com> writes:
> > > Accepted? PICK and ROLL are accepted because they had history. -ROLL
> > > had less use - why few systems implement it. STICK (which I'd not heard
> > > of until today) seems to have no precedence. Worth getting angry about?
> > > Only if 200x were to adopt it.
> > STICK seems like something of a travesty even to me. I thought of it
> > because of the discussion of stack cpu's. With STICK (at least for
> > fixed offset) in hardware, the stack cpu can also be used as something
> > like a register cpu, targeted by a relatively conventional compiler for
> > infix languages.
> STICK would be hard to implement in hardware and is NOTHING like accessing registers.
> STICK requires every word between the insertion point and the top to be copied up. Very messy no matter the implementation.

No it doesn't, -ROLL does. STICK simply overwrites the referenced stack cell e.g. if you type
-123 10 STICK \ then
10 PICK . \ should display -123

--
Gerry

Re: evil stack words

<f0a11bf0-df9f-48f2-ab14-8d7a4722e050n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15569&group=comp.lang.forth#15569

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:6390:: with SMTP id x138mr7936344qkb.146.1639561353498;
Wed, 15 Dec 2021 01:42:33 -0800 (PST)
X-Received: by 2002:a05:620a:2996:: with SMTP id r22mr7791414qkp.485.1639561353327;
Wed, 15 Dec 2021 01:42:33 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 15 Dec 2021 01:42:33 -0800 (PST)
In-Reply-To: <86958632-d81a-46ad-a2d8-d727293b030fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f26:2ca4:241b:1ce6:a196:c494;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f26:2ca4:241b:1ce6:a196:c494
References: <87k0g71q7o.fsf@nightsong.com> <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org>
<87bl1i1qgq.fsf@nightsong.com> <91d0614a-b581-44f2-bf3a-bee13fbfeb83n@googlegroups.com>
<86958632-d81a-46ad-a2d8-d727293b030fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f0a11bf0-df9f-48f2-ab14-8d7a4722e050n@googlegroups.com>
Subject: Re: evil stack words
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Wed, 15 Dec 2021 09:42:33 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 20
 by: minf...@arcor.de - Wed, 15 Dec 2021 09:42 UTC

Gerry Jackson schrieb am Mittwoch, 15. Dezember 2021 um 09:25:21 UTC+1:
> On Wednesday, December 15, 2021 at 7:16:12 AM UTC, gnuarm.del...@gmail.com wrote:
> > On Tuesday, December 14, 2021 at 11:45:13 PM UTC-4, Paul Rubin wrote:
> > > dxforth <dxf...@gmail.com> writes:
> > > > Accepted? PICK and ROLL are accepted because they had history. -ROLL
> > > > had less use - why few systems implement it. STICK (which I'd not heard
> > > > of until today) seems to have no precedence. Worth getting angry about?
> > > > Only if 200x were to adopt it.
> > > STICK seems like something of a travesty even to me. I thought of it
> > > because of the discussion of stack cpu's. With STICK (at least for
> > > fixed offset) in hardware, the stack cpu can also be used as something
> > > like a register cpu, targeted by a relatively conventional compiler for
> > > infix languages.
> > STICK would be hard to implement in hardware and is NOTHING like accessing registers.
> > STICK requires every word between the insertion point and the top to be copied up. Very messy no matter the implementation.
> No it doesn't, -ROLL does. STICK simply overwrites the referenced stack cell e.g. if you type
> -123 10 STICK \ then
> 10 PICK . \ should display -123
>

When I am tempted to use PICK and ROLL ... it often ends with locals: short and readable code.

Re: evil stack words

<2021Dec15.105041@mips.complang.tuwien.ac.at>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15570&group=comp.lang.forth#15570

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Wed, 15 Dec 2021 09:50:41 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 51
Message-ID: <2021Dec15.105041@mips.complang.tuwien.ac.at>
References: <87k0g71q7o.fsf@nightsong.com> <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com> <87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org> <87bl1i1qgq.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="a8a784a0e27a38c33afe36d9bc6d50d3";
logging-data="20561"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IUupGesF8c48q6Fw2hGjQ"
Cancel-Lock: sha1:hlEvMCsyqLAeHSPzG2g1z1vIVuA=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Wed, 15 Dec 2021 09:50 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>STICK seems like something of a travesty even to me.

I actually did not think that we have it in Gforth before Gerry
Jackson reminded me of it. It's there because it is used, in the
following words:

OPT:
defines the optimization action of a word (syntactic sugar for
SET-OPTIMIZER)
COMP-DOES> INT-DOES>
the compilation semantics and interpretation semantics of DOES>
END-DCLOSURE [*::
factors of the closure definition words

All these are (parts of) compiling words where a colon-sys or similar
multi-cell thingy is above the stack item (typically an xt) that needs
to be stored. So we have a sequence of events like

beginning word: push colon-sys stick xt
word1: perform word1's compilation semantics
word2: perform word2's compilation semantics
ending word: consume colon-sys use xt

It may be possible to use something other than STICK for this purpose,
but apparently STICK was considered the lesser evil in these cases.

>I thought of it
>because of the discussion of stack cpu's. With STICK (at least for
>fixed offset) in hardware, the stack cpu can also be used as something
>like a register cpu, targeted by a relatively conventional compiler for
>infix languages.

Sure, you would not be too far off the JavaVM.

>ROLL with negative arg (or -ROLL) does seem to me worth standardizing or
>at least documenting as optional, if ROLL itself (with nonnegative arg)
>is standardized.

Common practice?

Gforth uses ROLL only for implementing CS-ROLL. I have yet to see the
need for -ROLL (you can probably replace the uses of STICK above with
uses of -ROLL, but STICK is cheaper).

- 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 2021: https://euro.theforth.net/2021

Re: evil stack words

<spciej$1dfa$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15571&group=comp.lang.forth#15571

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Wed, 15 Dec 2021 22:10:13 +1100
Organization: Aioe.org NNTP Server
Message-ID: <spciej$1dfa$1@gioia.aioe.org>
References: <87k0g71q7o.fsf@nightsong.com>
<7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org>
<87bl1i1qgq.fsf@nightsong.com>
<91d0614a-b581-44f2-bf3a-bee13fbfeb83n@googlegroups.com>
<86958632-d81a-46ad-a2d8-d727293b030fn@googlegroups.com>
<f0a11bf0-df9f-48f2-ab14-8d7a4722e050n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="46570"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Wed, 15 Dec 2021 11:10 UTC

On 15/12/2021 20:42, minf...@arcor.de wrote:
> Gerry Jackson schrieb am Mittwoch, 15. Dezember 2021 um 09:25:21 UTC+1:
>> On Wednesday, December 15, 2021 at 7:16:12 AM UTC, gnuarm.del...@gmail.com wrote:
>> > On Tuesday, December 14, 2021 at 11:45:13 PM UTC-4, Paul Rubin wrote:
>> > > dxforth <dxf...@gmail.com> writes:
>> > > > Accepted? PICK and ROLL are accepted because they had history. -ROLL
>> > > > had less use - why few systems implement it. STICK (which I'd not heard
>> > > > of until today) seems to have no precedence. Worth getting angry about?
>> > > > Only if 200x were to adopt it.
>> > > STICK seems like something of a travesty even to me. I thought of it
>> > > because of the discussion of stack cpu's. With STICK (at least for
>> > > fixed offset) in hardware, the stack cpu can also be used as something
>> > > like a register cpu, targeted by a relatively conventional compiler for
>> > > infix languages.
>> > STICK would be hard to implement in hardware and is NOTHING like accessing registers.
>> > STICK requires every word between the insertion point and the top to be copied up. Very messy no matter the implementation.
>> No it doesn't, -ROLL does. STICK simply overwrites the referenced stack cell e.g. if you type
>> -123 10 STICK \ then
>> 10 PICK . \ should display -123
>>
>
> When I am tempted to use PICK and ROLL ... it often ends with locals: short and readable code.
>

Are you sure it's not the devil tempting :)

┌──────────────────────────┐
│ MinForth V3.4.8 - 32 bit │
└──────────────────────────┘
Stacks: d:128 / r:128 / f:16
Dataspace: 1,048,576

# : t1 2 pick ; ok

# : t2 {: a b c :} a b c a ; ok

# see t1
: t1 _[LIT] 2 PICK ; ok

# see t2
: t2 _[L:] 4 _[L] 3 ! _[L] 2 ! _[L] 1 ! _[L] 1 @ _[L] 2 @ _[L] 3 @ _[L] 1 @ _[;L] ; ok

Re: evil stack words

<2021Dec15.155434@mips.complang.tuwien.ac.at>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15572&group=comp.lang.forth#15572

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Wed, 15 Dec 2021 14:54:34 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 17
Message-ID: <2021Dec15.155434@mips.complang.tuwien.ac.at>
References: <87k0g71q7o.fsf@nightsong.com> <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com> <87fsqv127n.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="a8a784a0e27a38c33afe36d9bc6d50d3";
logging-data="3237"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+iA6u8XZyxfmmj3if8Qpmh"
Cancel-Lock: sha1:zMIlBYoDHP+B8cHYlsm8uVVdu6M=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Wed, 15 Dec 2021 14:54 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>Gforth 0.7.3 doesn't seem to have this, and it's not in the online docs
>at http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ .

It's also not documented in the current snapshot. This means that it
is a gforth-internal word that may vanish if somebody decides to use
something else for the cases where it is used now. If you are using
it now in a program that should also work in future versions of
Gforth, please send a request for blessing it as supported (and
documented) word; we then may (or may not) agree with this request.

- 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 2021: https://euro.theforth.net/2021

Re: evil stack words

<2021Dec15.160241@mips.complang.tuwien.ac.at>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15573&group=comp.lang.forth#15573

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Wed, 15 Dec 2021 15:02:41 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 13
Message-ID: <2021Dec15.160241@mips.complang.tuwien.ac.at>
References: <87k0g71q7o.fsf@nightsong.com> <sp9pkt$1jj5$1@gioia.aioe.org>
Injection-Info: reader02.eternal-september.org; posting-host="a8a784a0e27a38c33afe36d9bc6d50d3";
logging-data="3237"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5oH5sWWgUw7a9HKDyrJm6"
Cancel-Lock: sha1:z09n//+prg5LF5CT+e3ORFgio3A=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Wed, 15 Dec 2021 15:02 UTC

dxforth <dxforth@gmail.com> writes:
>Swiftforth has -ROLL

Where -ROLL shows that it is not used in the SwiftForth sources; ROLL
is used once, for CS-ROLL. PICK is used 16 times, mostly as 2 PICK,
with some 3 PICK and 4 PICK around, and one case of "I PICK".

- 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 2021: https://euro.theforth.net/2021

Re: evil stack words

<35310215-ff48-4173-b857-d580f98ecc4fn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15574&group=comp.lang.forth#15574

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:528d:: with SMTP id kj13mr5529395qvb.70.1639594016262;
Wed, 15 Dec 2021 10:46:56 -0800 (PST)
X-Received: by 2002:a05:6214:c8a:: with SMTP id r10mr12500473qvr.38.1639594016011;
Wed, 15 Dec 2021 10:46:56 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 15 Dec 2021 10:46:55 -0800 (PST)
In-Reply-To: <spciej$1dfa$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f26:2c2f:51d3:cca1:8a98:311d;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f26:2c2f:51d3:cca1:8a98:311d
References: <87k0g71q7o.fsf@nightsong.com> <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org>
<87bl1i1qgq.fsf@nightsong.com> <91d0614a-b581-44f2-bf3a-bee13fbfeb83n@googlegroups.com>
<86958632-d81a-46ad-a2d8-d727293b030fn@googlegroups.com> <f0a11bf0-df9f-48f2-ab14-8d7a4722e050n@googlegroups.com>
<spciej$1dfa$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <35310215-ff48-4173-b857-d580f98ecc4fn@googlegroups.com>
Subject: Re: evil stack words
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Wed, 15 Dec 2021 18:46:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 78
 by: minf...@arcor.de - Wed, 15 Dec 2021 18:46 UTC

dxforth schrieb am Mittwoch, 15. Dezember 2021 um 12:10:14 UTC+1:
> On 15/12/2021 20:42, minf...@arcor.de wrote:
> > Gerry Jackson schrieb am Mittwoch, 15. Dezember 2021 um 09:25:21 UTC+1:
> >> On Wednesday, December 15, 2021 at 7:16:12 AM UTC, gnuarm.del...@gmail..com wrote:
> >> > On Tuesday, December 14, 2021 at 11:45:13 PM UTC-4, Paul Rubin wrote:
> >> > > dxforth <dxf...@gmail.com> writes:
> >> > > > Accepted? PICK and ROLL are accepted because they had history. -ROLL
> >> > > > had less use - why few systems implement it. STICK (which I'd not heard
> >> > > > of until today) seems to have no precedence. Worth getting angry about?
> >> > > > Only if 200x were to adopt it.
> >> > > STICK seems like something of a travesty even to me. I thought of it
> >> > > because of the discussion of stack cpu's. With STICK (at least for
> >> > > fixed offset) in hardware, the stack cpu can also be used as something
> >> > > like a register cpu, targeted by a relatively conventional compiler for
> >> > > infix languages.
> >> > STICK would be hard to implement in hardware and is NOTHING like accessing registers.
> >> > STICK requires every word between the insertion point and the top to be copied up. Very messy no matter the implementation.
> >> No it doesn't, -ROLL does. STICK simply overwrites the referenced stack cell e.g. if you type
> >> -123 10 STICK \ then
> >> 10 PICK . \ should display -123
> >>
> >
> > When I am tempted to use PICK and ROLL ... it often ends with locals: short and readable code.
> >
> Are you sure it's not the devil tempting :)
>
> ┌──────────────────────────┐
> │ MinForth V3.4.8 - 32 bit │
> └──────────────────────────┘
> Stacks: d:128 / r:128 / f:16
> Dataspace: 1,048,576
>
> # : t1 2 pick ; ok
>
> # : t2 {: a b c :} a b c a ; ok
>
> # see t1
> : t1 _[LIT] 2 PICK ; ok
>
> # see t2
> : t2 _[L:] 4 _[L] 3 ! _[L] 2 ! _[L] 1 ! _[L] 1 @ _[L] 2 @ _[L] 3 @ _[L] 1 @ _[;L] ; ok

:o) nice, but obviously misleading. What I wanted to say is common oberservation:
when your application requires words that dig deep down into the stack, formulating
the solution with locals is often better.

Perhaps so because (somewhat similar to gforth) I have also double, floating point
and complex number locals, which can reduce needs for deep PICKs and ROLLs. OTOH
I use N>R and NR> more often than I thought earlier.

While we are talking about "evil stack words" one of my favourites has become:
FLIP ( a b c -- c b a )
Non-standard but often very handy.

Re: evil stack words

<e4e1a696-fc91-4c59-99f4-9e75fd93641dn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15575&group=comp.lang.forth#15575

 copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:8124:: with SMTP id 33mr7333716qvc.77.1639596053949;
Wed, 15 Dec 2021 11:20:53 -0800 (PST)
X-Received: by 2002:a37:6152:: with SMTP id v79mr10066601qkb.188.1639596053753;
Wed, 15 Dec 2021 11:20:53 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 15 Dec 2021 11:20:53 -0800 (PST)
In-Reply-To: <86958632-d81a-46ad-a2d8-d727293b030fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.137.246.135; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 24.137.246.135
References: <87k0g71q7o.fsf@nightsong.com> <7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org>
<87bl1i1qgq.fsf@nightsong.com> <91d0614a-b581-44f2-bf3a-bee13fbfeb83n@googlegroups.com>
<86958632-d81a-46ad-a2d8-d727293b030fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e4e1a696-fc91-4c59-99f4-9e75fd93641dn@googlegroups.com>
Subject: Re: evil stack words
From: gnuarm.d...@gmail.com (Rick C)
Injection-Date: Wed, 15 Dec 2021 19:20:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 44
 by: Rick C - Wed, 15 Dec 2021 19:20 UTC

On Wednesday, December 15, 2021 at 4:25:21 AM UTC-4, Gerry Jackson wrote:
> On Wednesday, December 15, 2021 at 7:16:12 AM UTC, gnuarm.del...@gmail.com wrote:
> > On Tuesday, December 14, 2021 at 11:45:13 PM UTC-4, Paul Rubin wrote:
> > > dxforth <dxf...@gmail.com> writes:
> > > > Accepted? PICK and ROLL are accepted because they had history. -ROLL
> > > > had less use - why few systems implement it. STICK (which I'd not heard
> > > > of until today) seems to have no precedence. Worth getting angry about?
> > > > Only if 200x were to adopt it.
> > > STICK seems like something of a travesty even to me. I thought of it
> > > because of the discussion of stack cpu's. With STICK (at least for
> > > fixed offset) in hardware, the stack cpu can also be used as something
> > > like a register cpu, targeted by a relatively conventional compiler for
> > > infix languages.
> > STICK would be hard to implement in hardware and is NOTHING like accessing registers.
> > STICK requires every word between the insertion point and the top to be copied up. Very messy no matter the implementation.
> No it doesn't, -ROLL does. STICK simply overwrites the referenced stack cell e.g. if you type
> -123 10 STICK \ then
> 10 PICK . \ should display -123

I misunderstood. So ROLL is like ROT and STICK is like... well, like nothing else I guess. The zero case would make 0 STICK equivalent to NIP? POKE would be a better name for it I think other than that that is often used in other languages for I/O operations, i.e. PEEK and POKE. That might be a bit confusing since STICK only applies to the stack.

I have no problem with Forth using a stack... as long as I don't need to know too much about it. lol

--

Rick C.

+ Get 1,000 miles of free Supercharging
+ Tesla referral code - https://ts.la/richard11209

Re: evil stack words

<spe5qe$q51$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15579&group=comp.lang.forth#15579

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Thu, 16 Dec 2021 12:46:57 +1100
Organization: Aioe.org NNTP Server
Message-ID: <spe5qe$q51$1@gioia.aioe.org>
References: <87k0g71q7o.fsf@nightsong.com> <sp9pkt$1jj5$1@gioia.aioe.org>
<2021Dec15.160241@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="26785"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Thu, 16 Dec 2021 01:46 UTC

On 16/12/2021 02:02, Anton Ertl wrote:
> dxforth <dxforth@gmail.com> writes:
>>Swiftforth has -ROLL
>
> Where -ROLL shows that it is not used in the SwiftForth sources; ROLL
> is used once, for CS-ROLL. PICK is used 16 times, mostly as 2 PICK,
> with some 3 PICK and 4 PICK around, and one case of "I PICK".
>

In the Windows version -ROLL is used 12 times and it's ROLL they appear
to avoid. In other forths the opposite may be true. While there's not
a lot of good reasons to use ROLL or its opposite, it's hard to argue
there's never one. In my case it was implement -ROLL or another stack.
I opted for the former.

Re: evil stack words

<8735mt162n.fsf@nightsong.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15580&group=comp.lang.forth#15580

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Wed, 15 Dec 2021 21:17:52 -0800
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <8735mt162n.fsf@nightsong.com>
References: <87k0g71q7o.fsf@nightsong.com> <sp9pkt$1jj5$1@gioia.aioe.org>
<2021Dec15.160241@mips.complang.tuwien.ac.at>
<spe5qe$q51$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="14e6122329598e7e451dfed5829e78c9";
logging-data="3827"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TFVpiodK7ppR6k1aaT3No"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:J9XjINuJ8GaGzYFdCQQmRDi3nIw=
sha1:RUmGTboZRzhwyt42NKbgTcfPj94=
 by: Paul Rubin - Thu, 16 Dec 2021 05:17 UTC

dxforth <dxforth@gmail.com> writes:
> While there's not a lot of good reasons to use ROLL or its opposite,
> it's hard to argue there's never one.

ROLL has always seemed suspicious to me, but having ROLL without -ROLL
seems weird.

> In my case it was implement -ROLL or another stack. I opted for the
> former.

Interesting. There are a few Forths including Flashforth that do have
an extra stack. I guess the implementation is still simple.

Re: evil stack words

<spemde$1d99$1@gioia.aioe.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15584&group=comp.lang.forth#15584

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Thu, 16 Dec 2021 17:30:08 +1100
Organization: Aioe.org NNTP Server
Message-ID: <spemde$1d99$1@gioia.aioe.org>
References: <87k0g71q7o.fsf@nightsong.com> <sp9pkt$1jj5$1@gioia.aioe.org>
<2021Dec15.160241@mips.complang.tuwien.ac.at> <spe5qe$q51$1@gioia.aioe.org>
<8735mt162n.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="46377"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Thu, 16 Dec 2021 06:30 UTC

On 16/12/2021 16:17, Paul Rubin wrote:
> ...
> ROLL has always seemed suspicious to me, but having ROLL without -ROLL
> seems weird.

ROLL was commonly used in multi-cell stack ops e.g. this from LMI's I80387:

: FROT
0B ROLL 0B ROLL 0B ROLL 0B ROLL ;

: FPICK
1+ 4 * 1- DUP >R PICK R@ PICK R@ PICK R> PICK ;

: FROLL
1+ 4 * 1- DUP >R ROLL R@ ROLL R@ ROLL R> ROLL ;

Re: evil stack words

<spete9$pi7$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=15587&group=comp.lang.forth#15587

 copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!news.swapon.de!news.mixmin.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: evil stack words
Date: Thu, 16 Dec 2021 08:30:02 +0000
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <spete9$pi7$1@dont-email.me>
References: <87k0g71q7o.fsf@nightsong.com>
<7df926d1-2770-42dd-bca9-8c68f8fecc47n@googlegroups.com>
<87fsqv127n.fsf@nightsong.com> <spbhj2$1os$1@gioia.aioe.org>
<87bl1i1qgq.fsf@nightsong.com>
<91d0614a-b581-44f2-bf3a-bee13fbfeb83n@googlegroups.com>
<86958632-d81a-46ad-a2d8-d727293b030fn@googlegroups.com>
<e4e1a696-fc91-4c59-99f4-9e75fd93641dn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 16 Dec 2021 08:30:01 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8053d5490c7477ebb12f77201573d28e";
logging-data="26183"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Y5ClT2FksehLsX9/7dBMdukzkoJDFFZU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.0
Cancel-Lock: sha1:C2G+28cOzZKvSa3OjPP5kuUfFL8=
In-Reply-To: <e4e1a696-fc91-4c59-99f4-9e75fd93641dn@googlegroups.com>
 by: Gerry Jackson - Thu, 16 Dec 2021 08:30 UTC

On 15/12/2021 19:20, Rick C wrote:
> On Wednesday, December 15, 2021 at 4:25:21 AM UTC-4, Gerry Jackson wrote:
>> On Wednesday, December 15, 2021 at 7:16:12 AM UTC, gnuarm.del...@gmail.com wrote:
>>> On Tuesday, December 14, 2021 at 11:45:13 PM UTC-4, Paul Rubin wrote:
>>>> dxforth <dxf...@gmail.com> writes:
>>>>> Accepted? PICK and ROLL are accepted because they had history. -ROLL
>>>>> had less use - why few systems implement it. STICK (which I'd not heard
>>>>> of until today) seems to have no precedence. Worth getting angry about?
>>>>> Only if 200x were to adopt it.
>>>> STICK seems like something of a travesty even to me. I thought of it
>>>> because of the discussion of stack cpu's. With STICK (at least for
>>>> fixed offset) in hardware, the stack cpu can also be used as something
>>>> like a register cpu, targeted by a relatively conventional compiler for
>>>> infix languages.
>>> STICK would be hard to implement in hardware and is NOTHING like accessing registers.
>>> STICK requires every word between the insertion point and the top to be copied up. Very messy no matter the implementation.
>> No it doesn't, -ROLL does. STICK simply overwrites the referenced stack cell e.g. if you type
>> -123 10 STICK \ then
>> 10 PICK . \ should display -123
>
> I misunderstood. So ROLL is like ROT and STICK is like... well, like nothing else I guess. The zero case would make 0 STICK equivalent to NIP? POKE would be a better name for it

The Forth purists would probably want to call it PUKE :)

> I think other than that that is often used in other languages for I/O operations, i.e. PEEK and POKE. That might be a bit confusing since STICK only applies to the stack.
>
> I have no problem with Forth using a stack... as long as I don't need to know too much about it. lol
>

--
Gerry

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor