Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Programmers do it bit by bit.


devel / comp.lang.forth / Re: Not really locals

SubjectAuthor
* Not really localsPaul Rubin
+* Re: Not really localsPaul Rubin
|`- Re: Not really localsHans Bezemer
+- Re: Not really localsMarcel Hendrix
+* Re: Not really localsAnton Ertl
|+- Re: Not really localsP Falth
|`* Re: Not really localsdxforth
| +* Re: Not really localsPaul Rubin
| |`* Re: Not really localsdxforth
| | `* Re: Not really localsPaul Rubin
| |  +* Re: Not really localsMarcel Hendrix
| |  |`- Re: Not really localsAnton Ertl
| |  +* Re: Not really localsdxforth
| |  |`- Re: Not really localsPaul Rubin
| |  `* Re: Not really localsAndy Valencia
| |   `* Re: Not really localsdxforth
| |    `* Re: Not really localsPaul Rubin
| |     `* Re: Not really localsdxforth
| |      `* Re: Not really localsPaul Rubin
| |       `- Re: Not really localsdxforth
| `* Re: Not really localsDoug Hoffman
|  `* Re: Not really localsPaul Rubin
|   `* Re: Not really localsAnton Ertl
|    +* Re: Not really localsDoug Hoffman
|    |`- Re: Not really localsAnton Ertl
|    `* Re: Not really localsPaul Rubin
|     +* Re: Not really localsdxforth
|     |`* Re: Not really localsPaul Rubin
|     | +* Re: Not really localsdxforth
|     | |`- Re: Not really localsPaul Rubin
|     | +* Re: Not really localsHans Bezemer
|     | |+* Re: Not really localsHugh Aguilar
|     | ||`* Re: Not really localsdxforth
|     | || `* Re: Not really localsHugh Aguilar
|     | ||  `* Re: Not really localsdxforth
|     | ||   `* Re: Not really localsHugh Aguilar
|     | ||    `- Re: Not really localsdxforth
|     | |`* Re: Not really localsPaul Rubin
|     | | `* Re: Not really localsdxforth
|     | |  `* Re: Not really localsPaul Rubin
|     | |   +- Re: Not really localsdxforth
|     | |   +- Re: Not really localsHugh Aguilar
|     | |   `* Re: Not really localsdxforth
|     | |    `* Re: Not really localsPaul Rubin
|     | |     `* Re: Not really localsdxforth
|     | |      `* Re: Not really localsPaul Rubin
|     | |       `* Re: Not really localsdxforth
|     | |        `* Re: Not really localsPaul Rubin
|     | |         `* Re: Not really localsHans Bezemer
|     | |          +* Re: Not really localsminf...@arcor.de
|     | |          |`* Re: Not really localsdxforth
|     | |          | +- Re: Not really localsminf...@arcor.de
|     | |          | `- Re: Not really localsHans Bezemer
|     | |          +* Re: Not really localsPaul Rubin
|     | |          |`* Re: Not really localsdxforth
|     | |          | `* Re: Not really localsPaul Rubin
|     | |          |  +* Re: Not really localsdxforth
|     | |          |  |+* Re: Not really localsS Jack
|     | |          |  ||`- Re: Not really localsHugh Aguilar
|     | |          |  |`- Re: Not really localsPaul Rubin
|     | |          |  `* Re: Not really localsdxforth
|     | |          |   +* Re: Not really localsPaul Rubin
|     | |          |   |+- Re: Not really localsdxforth
|     | |          |   |`* Re: Not really localsHans Bezemer
|     | |          |   | `* Re: Not really localsHans Bezemer
|     | |          |   |  +* Re: Not really localsPaul Rubin
|     | |          |   |  |+- Re: Not really localsPaul Rubin
|     | |          |   |  |`* Re: Not really localsminf...@arcor.de
|     | |          |   |  | +* Re: Not really localsPaul Rubin
|     | |          |   |  | |`* Re: Not really localsHans Bezemer
|     | |          |   |  | | +* Re: Not really localsdxforth
|     | |          |   |  | | |`- Re: Not really localsdxforth
|     | |          |   |  | | `* Re: Not really localsPaul Rubin
|     | |          |   |  | |  +* Re: Not really localsHans Bezemer
|     | |          |   |  | |  |`- Re: Not really localsPaul Rubin
|     | |          |   |  | |  `- Re: Not really localsdxforth
|     | |          |   |  | `* Re: Not really localsAndy Valencia
|     | |          |   |  |  +* Re: Not really localsMarcel Hendrix
|     | |          |   |  |  |+- Re: Not really localsAnton Ertl
|     | |          |   |  |  |`- Re: Not really localsS Jack
|     | |          |   |  |  +* Re: Not really localsAndy Valencia
|     | |          |   |  |  |+- Re: Not really localsdxforth
|     | |          |   |  |  |+* Re: Not really localsMarcel Hendrix
|     | |          |   |  |  ||`- Re: Not really localsminf...@arcor.de
|     | |          |   |  |  |`- Re: Not really localsAndy Valencia
|     | |          |   |  |  `* Re: Not really localsHans Bezemer
|     | |          |   |  |   `* Re: Not really localsPaul Rubin
|     | |          |   |  |    +* Re: Not really localsAnton Ertl
|     | |          |   |  |    |`* Re: Not really localsHans Bezemer
|     | |          |   |  |    | +* Re: Not really localsPaul Rubin
|     | |          |   |  |    | |+- Re: Not really localsdxforth
|     | |          |   |  |    | |+* static type checking (was: Not really locals)Anton Ertl
|     | |          |   |  |    | ||`- Re: static type checkingPaul Rubin
|     | |          |   |  |    | |`* Re: Not really localsS Jack
|     | |          |   |  |    | | +- Re: Not really localsDoug Hoffman
|     | |          |   |  |    | | `- Re: Not really localsdxforth
|     | |          |   |  |    | `* Re: Not really localsAnton Ertl
|     | |          |   |  |    |  +- Re: Not really localsHans Bezemer
|     | |          |   |  |    |  `* Re: Not really localsPaul Rubin
|     | |          |   |  |    |   +* Re: Not really localsHans Bezemer
|     | |          |   |  |    |   |`- Re: Not really localsdxforth
|     | |          |   |  |    |   +* Re: Not really localsS Jack
|     | |          |   |  |    |   `- Re: Not really localsdxforth
|     | |          |   |  |    `* Re: Not really localsdxforth
|     | |          |   |  `* Re: Not really localsdxforth
|     | |          |   `- Re: Not really localsAnton Ertl
|     | |          `* Re: Not really localsRuvim
|     | +- Re: Not really localsMarcel Hendrix
|     | `- Re: Not really localsMarcel Hendrix
|     `* Re: Not really localsAnton Ertl
+* Re: Not really localsS Jack
`- Re: Not really localsHugh Aguilar

Pages:1234567
Re: Not really locals

<shcblr$1tqu$1@gioia.aioe.org>

  copy mid

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

  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: Not really locals
Date: Thu, 9 Sep 2021 17:04:27 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shcblr$1tqu$1@gioia.aioe.org>
References: <87mtp3ux27.fsf@nightsong.com> <87eea6tyl4.fsf@nightsong.com>
<2021Sep3.120548@mips.complang.tuwien.ac.at> <875yvhtttk.fsf@nightsong.com>
<sgv015$ckc$1@gioia.aioe.org> <87wnnwswj7.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com>
<87o897sn3l.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.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="63326"; 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:78.0) Gecko/20100101
Thunderbird/78.13.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Thu, 9 Sep 2021 07:04 UTC

On 9/09/2021 05:49, Paul Rubin wrote:
> dxforth <dxforth@gmail.com> writes:
>> defer moveto ' 2drop is moveto
>> defer lineto ' 2drop is lineto
>>
>> : RECT1 { x1 y1 x2 y2 -- }
>> x1 y1 moveto x2 y1 lineto
>> x2 y2 lineto x1 y2 lineto x1 y1 lineto ;
>
> Bytecode compilation:
>
> LOCAL1 LOCAL2 CALL moveto
> LOCAL3 LOCAL2 CALL moveto
> LOCAL3 LOCAL4 CALL lineto
> LOCAL1 LOCAL2 CALL lineto
>
> Bytecodes LOCAL1..LOCAL4 and CALL are 1 byte each, code addresses 2
> bytes, total 20 bytes. Actually maybe could use GreenArrays-like
> instruction coding (top bit = CALL) to make <CALL address> 2 bytes, so
> 16 bytes total. That limits code space to 32k, but once you have that
> much you're not so hungry for it anyway.
>
>> : RECT2 ( x1 y1 x2 y2 -- ) \ P.Rubin c.l.f
>> 2over 2dup moveto 2over swap rot lineto
>> 2swap lineto lineto lineto ;
>
> 2OVER 2DUP CALL moveto
> 2OVER SWAP ROT CALL lineto
> 2SWAP CALL lineto
> CALL lineto CALL lineto
>
> 6+12=18 or 6+8=14 bytes, not bad, you saved 2 bytes. The code is much
> more confusing though. Was it worth it? Probably not imho.

No doubt a racing car is confusing under the hood. It's designed for
performance, not admiration - though I'm sure engineers do, especially
when they've done it using a minimum number of parts.

Worth it? You tell me. Someone once said if a book is worth reading,
then it's worth thinking about. Having invested not a little time into
forth, it would be a disservice not to put in the effort to understand
where it's coming from and why.

Re: Not really locals

<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:d804:: with SMTP id h4mr2590728qvj.37.1631189897285;
Thu, 09 Sep 2021 05:18:17 -0700 (PDT)
X-Received: by 2002:a37:a80c:: with SMTP id r12mr2408027qke.299.1631189897047;
Thu, 09 Sep 2021 05:18:17 -0700 (PDT)
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: Thu, 9 Sep 2021 05:18:16 -0700 (PDT)
In-Reply-To: <87o892rgny.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=82.95.228.79; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 82.95.228.79
References: <87mtp3ux27.fsf@nightsong.com> <87eea6tyl4.fsf@nightsong.com>
<2021Sep3.120548@mips.complang.tuwien.ac.at> <875yvhtttk.fsf@nightsong.com>
<sgv015$ckc$1@gioia.aioe.org> <87wnnwswj7.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com> <87o897sn3l.fsf@nightsong.com>
<sh1j5u$gdi$1@gioia.aioe.org> <87k0jvscg0.fsf@nightsong.com>
<sh4osq$9sn$1@gioia.aioe.org> <877dftspq8.fsf@nightsong.com>
<sh6f2p$h91$1@gioia.aioe.org> <8735qhrvla.fsf@nightsong.com>
<sh6l4t$ic9$1@gioia.aioe.org> <87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com> <87h7ev6832.fsf@nightsong.com>
<sh9gfq$ebl$1@gioia.aioe.org> <87y287qy7c.fsf@nightsong.com>
<shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
Subject: Re: Not really locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Thu, 09 Sep 2021 12:18:17 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 120
 by: Hans Bezemer - Thu, 9 Sep 2021 12:18 UTC

On Wednesday, September 8, 2021 at 9:49:55 PM UTC+2, Paul Rubin wrote:
You don't have to murder the language to do it using the stack. You just got to understand the algorithm:

include lib/anscore.4th

: moveto ;
: lineto ;

: RECT1 ( x1 y1 x2 y2 -- ) \ J.L. Bezemer c.l.f
>r >r over over moveto
r@ over lineto r> r@ lineto
over r> lineto over over lineto
;

: RECT2 ( x1 y1 x2 y2 -- ) \ P.Rubin c.l.f
2over 2dup moveto 2over swap rot lineto
2swap lineto lineto lineto ;

IMHO this is just sloppy coding.

4tH message: No errors at word 89
Object size: 89 words
String size: 0 chars
Variables : 0 cells
Strings : 0 chars
Symbols : 9 names
Reliable : Yes

Addr| Opcode Operand Argument

0| branch 6 2!
1| swap 0
2| over 0
3| ! 0
4| +literal 1
5| ! 0
6| exit 0
7| branch 13 2@
8| dup 0
9| +literal 1
10| @ 0
11| swap 0
12| @ 0
13| exit 0
14| branch 25 2OVER
15| >r 0
16| >r 0
17| over 0
18| over 0
19| r> 0
20| r> 0
21| rot 0
22| >r 0
23| rot 0
24| r> 0
25| exit 0
26| branch 39 2ROT
27| >r 0
28| >r 0
29| rot 0
30| >r 0
31| rot 0
32| r> 0
33| r> 0
34| r> 0
35| rot 0
36| >r 0
37| rot 0
38| r> 0
39| exit 0
40| branch 50 2TUCK
41| over 0
42| >r 0
43| rot 0
44| >r 0
45| rot 0
46| over 0
47| r> 0
48| r> 0
49| rot 0
50| exit 0
51| branch 52 moveto
52| exit 0
53| branch 54 lineto
54| exit 0
55| branch 72 RECT1
56| >r 0
57| >r 0
58| over 0
59| over 0
60| call 51 moveto
61| r@ 0
62| over 0
63| call 53 lineto
64| r> 0
65| r@ 0
66| call 53 lineto
67| over 0
68| r> 0
69| call 53 lineto
70| over 0
71| over 0
72| branch 53 lineto
73| branch 88 RECT2
74| call 14 2OVER
75| over 0
76| over 0
77| call 51 moveto
78| call 14 2OVER
79| swap 0
80| rot 0
81| call 53 lineto
82| rot 0
83| >r 0
84| rot 0
85| r> 0
86| call 53 lineto
87| call 53 lineto
88| branch 53 lineto

Hans Bezemer

Re: Not really locals

<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:ab15:: with SMTP id u21mr2442195qke.439.1631190598235;
Thu, 09 Sep 2021 05:29:58 -0700 (PDT)
X-Received: by 2002:ac8:7d4e:: with SMTP id h14mr2504766qtb.404.1631190598109;
Thu, 09 Sep 2021 05:29:58 -0700 (PDT)
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: Thu, 9 Sep 2021 05:29:57 -0700 (PDT)
In-Reply-To: <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=82.95.228.79; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 82.95.228.79
References: <87mtp3ux27.fsf@nightsong.com> <87eea6tyl4.fsf@nightsong.com>
<2021Sep3.120548@mips.complang.tuwien.ac.at> <875yvhtttk.fsf@nightsong.com>
<sgv015$ckc$1@gioia.aioe.org> <87wnnwswj7.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com> <87o897sn3l.fsf@nightsong.com>
<sh1j5u$gdi$1@gioia.aioe.org> <87k0jvscg0.fsf@nightsong.com>
<sh4osq$9sn$1@gioia.aioe.org> <877dftspq8.fsf@nightsong.com>
<sh6f2p$h91$1@gioia.aioe.org> <8735qhrvla.fsf@nightsong.com>
<sh6l4t$ic9$1@gioia.aioe.org> <87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com> <87h7ev6832.fsf@nightsong.com>
<sh9gfq$ebl$1@gioia.aioe.org> <87y287qy7c.fsf@nightsong.com>
<shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com> <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
Subject: Re: Not really locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Thu, 09 Sep 2021 12:29:58 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 18
 by: Hans Bezemer - Thu, 9 Sep 2021 12:29 UTC

On Thursday, September 9, 2021 at 2:18:18 PM UTC+2, Hans Bezemer wrote:
Ok, not testing your code is immediately punished - as it should ;-)

include lib/anscore.4th

: moveto 2drop ;
: lineto 2drop ;

: RECT1 ( x1 y1 x2 y2 -- ) \ J.L. Bezemer c.l.f
>r >r over over moveto
r@ over lineto r> r@ lineto
over r> lineto lineto
;

: RECT2 ( x1 y1 x2 y2 -- ) \ P.Rubin c.l.f
2over 2dup moveto 2over swap rot lineto
2swap lineto lineto lineto ;

Hans Bezemer

Re: Not really locals

<87k0jpr6sd.fsf@nightsong.com>

  copy mid

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

  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: Not really locals
Date: Thu, 09 Sep 2021 10:35:30 -0700
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <87k0jpr6sd.fsf@nightsong.com>
References: <87mtp3ux27.fsf@nightsong.com> <sgv015$ckc$1@gioia.aioe.org>
<87wnnwswj7.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com>
<87o897sn3l.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="f850c114f9334e127dd6f678b75790ae";
logging-data="22233"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18/dv1+2aO9KO7+wLAB5Sfo"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:cvHk/XZ9hU+K3PovkUMh22kX9gs=
sha1:p7AU436bkaIgaGAEy7eEUWlcxRQ=
 by: Paul Rubin - Thu, 9 Sep 2021 17:35 UTC

Hans Bezemer <the.beez.speaks@gmail.com> writes:
> : RECT1 ( x1 y1 x2 y2 -- ) \ J.L. Bezemer c.l.f
> >r >r over over moveto
> r@ over lineto r> r@ lineto
> over r> lineto lineto ;

I count 18 bytes of bytecode if <CALL addr> is 2 bytes.

> : RECT2 ( x1 y1 x2 y2 -- ) \ P.Rubin c.l.f
> 2over 2dup moveto 2over swap rot lineto
> 2swap lineto lineto lineto ;

I think this is dxforth's version, also 18 bytes, assuming there are
bytecodes for 2dup, 2swap, rot etc. Note rot reaches 3 levels deep in
the stack 2swap reaches 4 levels, so why do we say the stack is not an
array?

Re: Not really locals

<874katr3ed.fsf@nightsong.com>

  copy mid

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

  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: Not really locals
Date: Thu, 09 Sep 2021 11:48:42 -0700
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <874katr3ed.fsf@nightsong.com>
References: <87mtp3ux27.fsf@nightsong.com> <87wnnwswj7.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com>
<87o897sn3l.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="f850c114f9334e127dd6f678b75790ae";
logging-data="23129"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eMH4R3rFRBE1JcvYgYJVp"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:kuXuC9U4svJ9nhLsG5gIVtMObeY=
sha1:Qwl27gxv4cp81RLnSAPtIp+cH70=
 by: Paul Rubin - Thu, 9 Sep 2021 18:48 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>> : RECT2 ( x1 y1 x2 y2 -- ) \ P.Rubin c.l.f
>> 2over 2dup moveto 2over swap rot lineto
>> 2swap lineto lineto lineto ;
>
> I think this is dxforth's version, also 18 bytes

No, sorry, I mis-counted. 16 bytes, and yours is 20 bytes. Although,
dxforth's has 8 items on the data stack some of the time. A possible
locals version:

: RECT3/4 { x1 y1 x2 y2 -- } x1 y1 moveto
x1 y2 lineto x2 y2 lineto x2 y1 lineto x1 y1 lineto ;

This is 20 bytes like yours, or maybe 21 depending on how the locals are
saved, but I think the action is much easier to understand.

: RECT5 ( x1 y1 x2 y2 -- ) 2dup moveto
3.pick over lineto ( x1 y1 x2 y2 )
nup lineto ( x1 y1 x2 )
nup lineto ( x1 y1 )
lineto ;

(untested) is 15 bytes assuming a single byte "3.pick" equivalent to "3
pick", and Rob Chapman's "nup" (= over swap). But the head scratching
needed for this really doesn't seem worth it. Serious optimization
attempts should be in assembler rather than interpreted languages. A
clever enough compiler might be able to turn the locals version into
that, though.

Since lineto is called 4 times, it's possible the compiler could also
constant-fold its address somehow, and save another byte or two. A
whole-program compiler could do that more aggressively.

Re: Not really locals

<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:448e:: with SMTP id x14mr4312571qkp.526.1631214439765;
Thu, 09 Sep 2021 12:07:19 -0700 (PDT)
X-Received: by 2002:ad4:5506:: with SMTP id az6mr4605106qvb.8.1631214439517;
Thu, 09 Sep 2021 12:07:19 -0700 (PDT)
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: Thu, 9 Sep 2021 12:07:19 -0700 (PDT)
In-Reply-To: <87k0jpr6sd.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=87.157.96.190; posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 87.157.96.190
References: <87mtp3ux27.fsf@nightsong.com> <sgv015$ckc$1@gioia.aioe.org>
<87wnnwswj7.fsf@nightsong.com> <842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com>
<87o897sn3l.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com> <f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com> <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com> <87k0jpr6sd.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
Subject: Re: Not really locals
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Thu, 09 Sep 2021 19:07:19 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 19
 by: minf...@arcor.de - Thu, 9 Sep 2021 19:07 UTC

Paul Rubin schrieb am Donnerstag, 9. September 2021 um 19:35:33 UTC+2:
> Hans Bezemer <the.bee...@gmail.com> writes:
> > : RECT1 ( x1 y1 x2 y2 -- ) \ J.L. Bezemer c.l.f
> > >r >r over over moveto
> > r@ over lineto r> r@ lineto
> > over r> lineto lineto ;
> I count 18 bytes of bytecode if <CALL addr> is 2 bytes.
> > : RECT2 ( x1 y1 x2 y2 -- ) \ P.Rubin c.l.f
> > 2over 2dup moveto 2over swap rot lineto
> > 2swap lineto lineto lineto ;
> I think this is dxforth's version, also 18 bytes, assuming there are
> bytecodes for 2dup, 2swap, rot etc. Note rot reaches 3 levels deep in
> the stack 2swap reaches 4 levels, so why do we say the stack is not an
> array?

For whatever reasons standard Forth requires that locals must not reside in
the data stack. IMO this was an unfortunate overspecification of implementation
options/techniques for locals, thereby forbidding stack frames that could
be addresses like arrays.

Re: Not really locals

<87zgslp1pu.fsf@nightsong.com>

  copy mid

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

  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: Not really locals
Date: Thu, 09 Sep 2021 20:07:57 -0700
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <87zgslp1pu.fsf@nightsong.com>
References: <87mtp3ux27.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com>
<87o897sn3l.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="e57d9908949e4869a405ea3cfe7018f6";
logging-data="3609"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UwaeZXJczZ93ZVtp72xl2"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:L/cPIBBCdBNQUHV2MWWVAuROwhE=
sha1:bJVtwUowcDjNd19pYalJ5IV1k1E=
 by: Paul Rubin - Fri, 10 Sep 2021 03:07 UTC

"minf...@arcor.de" <minforth@arcor.de> writes:
> For whatever reasons standard Forth requires that locals must not
> reside in the data stack. IMO this was an unfortunate
> overspecification of implementation options/techniques for locals,
> thereby forbidding stack frames that could be addresses like arrays.

People are uncomfortable with PICK even though it's presumably a Chuck
Moore invention. I'd expect something like POKE, writing into the stack
interior, would destroy the illusion the rest of the way.

Re: Not really locals

<shf0ep$1g95$1@gioia.aioe.org>

  copy mid

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

  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: Not really locals
Date: Fri, 10 Sep 2021 17:11:20 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shf0ep$1g95$1@gioia.aioe.org>
References: <87mtp3ux27.fsf@nightsong.com> <87eea6tyl4.fsf@nightsong.com>
<2021Sep3.120548@mips.complang.tuwien.ac.at> <875yvhtttk.fsf@nightsong.com>
<sgv015$ckc$1@gioia.aioe.org> <87wnnwswj7.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com>
<87o897sn3l.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.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="49445"; 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:78.0) Gecko/20100101
Thunderbird/78.14.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Fri, 10 Sep 2021 07:11 UTC

On 9/09/2021 22:29, Hans Bezemer wrote:
> On Thursday, September 9, 2021 at 2:18:18 PM UTC+2, Hans Bezemer wrote:
> Ok, not testing your code is immediately punished - as it should ;-)
>
> ...
>
> : RECT1 ( x1 y1 x2 y2 -- ) \ J.L. Bezemer c.l.f
> >r >r over over moveto
> r@ over lineto r> r@ lineto
> over r> lineto lineto
> ;

Does a little better on VFX (86/27 vs. 93/27).
On DX-Forth it's 14 instr vs. 11 assuming 2OVER.

Neither are particularly readable to me - nor need to be IMO.
The name should say it all, and short definitions in forth
costing less than in traditional languages it pans out.
Admittedly some may be concerned at the prospect of having
153 colon definitions (it surprised me too). But that's Forth,
and with it comes a new paradigm. Where I had used a colon
definition, others might use a structure.

Re: Not really locals

<7f6f1890-a829-4945-bed3-dcebfbd1aba2n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:b304:: with SMTP id s4mr7445340qve.34.1631268880330;
Fri, 10 Sep 2021 03:14:40 -0700 (PDT)
X-Received: by 2002:a05:622a:34c:: with SMTP id r12mr7106974qtw.147.1631268880188;
Fri, 10 Sep 2021 03:14:40 -0700 (PDT)
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: Fri, 10 Sep 2021 03:14:39 -0700 (PDT)
In-Reply-To: <87zgslp1pu.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=82.95.228.79; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 82.95.228.79
References: <87mtp3ux27.fsf@nightsong.com> <842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com>
<87o897sn3l.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com> <f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com> <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com> <87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com> <87zgslp1pu.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7f6f1890-a829-4945-bed3-dcebfbd1aba2n@googlegroups.com>
Subject: Re: Not really locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Fri, 10 Sep 2021 10:14:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 20
 by: Hans Bezemer - Fri, 10 Sep 2021 10:14 UTC

On Friday, September 10, 2021 at 5:07:59 AM UTC+2, Paul Rubin wrote:
> People are uncomfortable with PICK even though it's presumably a Chuck
> Moore invention. I'd expect something like POKE, writing into the stack
> interior, would destroy the illusion the rest of the way.

It MOST CERTAINLY isn't: "But as to stack parameters, the stacks should be shallow. On the i21 we have an on-chip stack 18 deep. This size was chosen as a number effectively infinite.
The words that manipulate that stack are DUP, DROP and OVER period. There's no, well SWAP is very convenient and you want it, but it isn't a machine instruction. But no PICK no ROLL, none of the complex operators to let you index down into the stack. This is the only part of the stack, these first two elements, that you have any business worrying about".

Fake news. You gotta learn the language properly. There's no easy way around it.

http://www.ultratechnology.com/moore4th.htm

Hans Bezemer

Re: Not really locals

<b46aa5b0-59a6-4fbb-bb1b-1a683764cea6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:9d92:: with SMTP id g140mr6856051qke.189.1631269794007;
Fri, 10 Sep 2021 03:29:54 -0700 (PDT)
X-Received: by 2002:a05:622a:394:: with SMTP id j20mr7284446qtx.196.1631269793893;
Fri, 10 Sep 2021 03:29:53 -0700 (PDT)
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: Fri, 10 Sep 2021 03:29:53 -0700 (PDT)
In-Reply-To: <shf0ep$1g95$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=82.95.228.79; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 82.95.228.79
References: <87mtp3ux27.fsf@nightsong.com> <87eea6tyl4.fsf@nightsong.com>
<2021Sep3.120548@mips.complang.tuwien.ac.at> <875yvhtttk.fsf@nightsong.com>
<sgv015$ckc$1@gioia.aioe.org> <87wnnwswj7.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com> <87o897sn3l.fsf@nightsong.com>
<sh1j5u$gdi$1@gioia.aioe.org> <87k0jvscg0.fsf@nightsong.com>
<sh4osq$9sn$1@gioia.aioe.org> <877dftspq8.fsf@nightsong.com>
<sh6f2p$h91$1@gioia.aioe.org> <8735qhrvla.fsf@nightsong.com>
<sh6l4t$ic9$1@gioia.aioe.org> <87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com> <87h7ev6832.fsf@nightsong.com>
<sh9gfq$ebl$1@gioia.aioe.org> <87y287qy7c.fsf@nightsong.com>
<shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com> <856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<shf0ep$1g95$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b46aa5b0-59a6-4fbb-bb1b-1a683764cea6n@googlegroups.com>
Subject: Re: Not really locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Fri, 10 Sep 2021 10:29:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 41
 by: Hans Bezemer - Fri, 10 Sep 2021 10:29 UTC

On Friday, September 10, 2021 at 9:11:24 AM UTC+2, dxforth wrote:
> Neither are particularly readable to me - nor need to be IMO.
That's why they invented comments. But I agree with you. Especially in libraries I don't care much about stack acrobatics. It's application programs that need MOST maintenance - not the libraries (if you're doing a great job)..

I confess - sometimes I do encounter a lib that is so messed up (often because 4tH is a developing language and some facilities were not implemented when the lib was created) I feel I have to redo the darn thing - but it's rare.

> The name should say it all, and short definitions in forth
> costing less than in traditional languages it pans out.
> Admittedly some may be concerned at the prospect of having
> 153 colon definitions (it surprised me too). But that's Forth,
> and with it comes a new paradigm. Where I had used a colon
> definition, others might use a structure.

And frankly, I do not care too much which version compiles to how many byte(code)s in which version. Often a compiler is a reflection of the view of that person to the problem at hand. So his preferred style of programming will be reflected in that benchmark.

E.g. I do not support locals in the core. I don't even support ANY "double" stack operator in the core. If the implementation of a "double" stack operator is just a few bytecodes, it's inlined. Others, like 2ROT and 2OVER are external and have to be explicitly included.

The only reason they're supported in the core as inlines is the support for address/count strings, which I added in v3.5 (which is now a long time ago, but anyways). So, using "double" stack operators in 4tH comes with a size and speed penalty.

If one support locals in ones core, since one likes to use locals, then yes - that will turn out to be quite efficient (at least size wise). Don't understand me wrong - I'm not out here to start a flamewar about whose implementation is best or whose design objectives are valid and whose's not - I'm simply trying to illustrate that "size" is a BAD metric for "efficiency" if you're performing it along several different compilers.

Hans Bezemer

Re: Not really locals

<shfj0m$plm$1@gioia.aioe.org>

  copy mid

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

  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: Not really locals
Date: Fri, 10 Sep 2021 22:28:06 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shfj0m$plm$1@gioia.aioe.org>
References: <87mtp3ux27.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com>
<87o897sn3l.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<87zgslp1pu.fsf@nightsong.com>
<7f6f1890-a829-4945-bed3-dcebfbd1aba2n@googlegroups.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="26294"; 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:78.0) Gecko/20100101
Thunderbird/78.14.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Fri, 10 Sep 2021 12:28 UTC

On 10/09/2021 20:14, Hans Bezemer wrote:
> On Friday, September 10, 2021 at 5:07:59 AM UTC+2, Paul Rubin wrote:
>> People are uncomfortable with PICK even though it's presumably a Chuck
>> Moore invention. I'd expect something like POKE, writing into the stack
>> interior, would destroy the illusion the rest of the way.
>
> It MOST CERTAINLY isn't: "But as to stack parameters, the stacks should be shallow. On the i21 we have an on-chip stack 18 deep. This size was chosen as a number effectively infinite.
> The words that manipulate that stack are DUP, DROP and OVER period. There's no, well SWAP is very convenient and you want it, but it isn't a machine instruction. But no PICK no ROLL, none of the complex operators to let you index down into the stack. This is the only part of the stack, these first two elements, that you have any business worrying about".
>
> Fake news. You gotta learn the language properly. There's no easy way around it.

FWIW the app I recently posted breaks down as follows:

#colon defs: #inputs:
100 0
26 1
16 2
9 3
1 4

While I have PICK and ROLL I had no cause to use them in this instance.

Re: Not really locals

<163128058713.22831.15524277815532345443@media.vsta.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: van...@vsta.org (Andy Valencia)
Newsgroups: comp.lang.forth
Subject: Re: Not really locals
Date: Fri, 10 Sep 2021 06:29:47 -0700
Lines: 11
Message-ID: <163128058713.22831.15524277815532345443@media.vsta.org>
References: <shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com> <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com> <856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com> <87k0jpr6sd.fsf@nightsong.com> <1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
X-Trace: individual.net GmnvMzSFiajq1mJPtZW4oAlzxQO19SDrz1TWbcN0DRfLwiOHzz
X-Orig-Path: media
Cancel-Lock: sha1:Qv9DVQ6USuca9hKZWfVblhcq30c=
User-Agent: rn.py v0.0.1
 by: Andy Valencia - Fri, 10 Sep 2021 13:29 UTC

Paul Rubin <no.email@nospam.invalid> writes:
> People are uncomfortable with PICK even though it's presumably a Chuck
> Moore invention. I'd expect something like POKE, writing into the stack
> interior, would destroy the illusion the rest of the way.

I've used pick on occasion, but never without the feeling that it was hack on
top of some code which could have been designed better.

Andy Valencia
Home page: https://www.vsta.org/andy/
To contact me: https://www.vsta.org/contact/andy.html

Re: Not really locals

<87mtok1it8.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.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: Not really locals
Date: Fri, 10 Sep 2021 09:44:51 -0700
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <87mtok1it8.fsf@nightsong.com>
References: <87mtp3ux27.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<87zgslp1pu.fsf@nightsong.com>
<7f6f1890-a829-4945-bed3-dcebfbd1aba2n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="4c9a568639d41b3b92e84fe87634af43";
logging-data="12309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UWyZVG4PO5MI7Kzft2uS6"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:XhSZAxCVK2sx3MThyY0tigb5IRs=
sha1:bHzbEafpRZWWGZszzslsp52sIUg=
 by: Paul Rubin - Fri, 10 Sep 2021 16:44 UTC

Hans Bezemer <the.beez.speaks@gmail.com> writes:
>> People are uncomfortable with PICK even though it's presumably a Chuck
>> Moore invention.
> It MOST CERTAINLY isn't: "But as to stack parameters, the stacks
> should be shallow. On the i21 we have an on-chip stack 18
> deep. .... But no PICK no ROLL...

The i21 and other such chips came well after the invention of PICK. So
if Moore didn't invent PICK, then who is the culprit and when did it
happen? The NRAO document "Forth, A Problem-Oriented Language" by Moore
and Rather (https://library.nrao.edu/public/memos/comp/CDIR_11.pdf
sec. 3.2, start near bottom of page 18 of the pdf, split across a
table), says:

Several words have been defined in basic FORTH for manipulating the
stack. summarized in the table. The operation of these words is A
fairly standard set of more complicated stack operators is available
in some developed applications, for such things as double precision
numbers, fetching numbers several levels down in the stack, etc.

The document itself doesn't describe PICK, but that paragraph seems to
say that someone needed it for an application so they implemented it.
Who was writing such applications in that era? What should they have
done instead, if they found the builtins (missing PICK at the time)
insufficient for getting their work done?

> Fake news. You gotta learn the language properly. There's no easy way
> around it.

Of course there is an easy way around it. It's just being treated as
objectionable on grounds that I'm still trying to understand.

Re: Not really locals

<f21b9830-a5fc-433e-846a-a6db1fb324cdn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:8f01:: with SMTP id r1mr8657703qkd.452.1631292413787;
Fri, 10 Sep 2021 09:46:53 -0700 (PDT)
X-Received: by 2002:a05:6214:13ee:: with SMTP id ch14mr2880835qvb.43.1631292413586;
Fri, 10 Sep 2021 09:46:53 -0700 (PDT)
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: Fri, 10 Sep 2021 09:46:53 -0700 (PDT)
In-Reply-To: <163128058713.22831.15524277815532345443@media.vsta.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:80e6:3df5:6993:da52;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:80e6:3df5:6993:da52
References: <shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com> <856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com> <1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<163128058713.22831.15524277815532345443@media.vsta.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f21b9830-a5fc-433e-846a-a6db1fb324cdn@googlegroups.com>
Subject: Re: Not really locals
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Fri, 10 Sep 2021 16:46:53 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: Marcel Hendrix - Fri, 10 Sep 2021 16:46 UTC

On Friday, September 10, 2021 at 3:31:17 PM UTC+2, Andy Valencia wrote:
> Paul Rubin <no.e...@nospam.invalid> writes:
> > People are uncomfortable with PICK even though it's presumably a Chuck
> > Moore invention. I'd expect something like POKE, writing into the stack
> > interior, would destroy the illusion the rest of the way.
> I've used pick on occasion, but never without the feeling that it was hack on
> top of some code which could have been designed better.

I find 565 occurences of PICK in a total of 2077 Forth files. Of these,
280 are for 2 PICK, far less for 3 PICK and almost none for n > 5.
Some call these THIRD and FOURTH, but for me that make no sense.
(DUP <= ONE, OVER <= SECOND ?)

-marcel

Re: Not really locals

<2021Sep10.213534@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Not really locals
Date: Fri, 10 Sep 2021 19:35:34 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 13
Message-ID: <2021Sep10.213534@mips.complang.tuwien.ac.at>
References: <shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com> <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com> <856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com> <87k0jpr6sd.fsf@nightsong.com> <1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com> <163128058713.22831.15524277815532345443@media.vsta.org> <f21b9830-a5fc-433e-846a-a6db1fb324cdn@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="1a6d691b34d84dabd769a887fb73da7e";
logging-data="26792"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1sp/2kLd0nC2/p8C7TLJP"
Cancel-Lock: sha1:o7dUBuCUOEPFnwvIdiLRexYZURk=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 10 Sep 2021 19:35 UTC

Marcel Hendrix <mhx@iae.nl> writes:
>Some call these THIRD and FOURTH, but for me that make no sense.
>(DUP <= ONE, OVER <= SECOND ?)

DUP = FIRST
OVER = SECOND

- 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: Not really locals

<163130555782.30996.8901879855645684112@media.vsta.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: van...@vsta.org (Andy Valencia)
Newsgroups: comp.lang.forth
Subject: Re: Not really locals
Date: Fri, 10 Sep 2021 13:25:57 -0700
Lines: 10
Message-ID: <163130555782.30996.8901879855645684112@media.vsta.org>
References: <f21b9830-a5fc-433e-846a-a6db1fb324cdn@googlegroups.com> <shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com> <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com> <856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com> <87k0jpr6sd.fsf@nightsong.com> <1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com> <163128058713.22831.15524277815532345443@media.vsta.org>
X-Trace: individual.net ZWno5b3gWhtmY7WvLsqzggrtmHkTrN7G8Vlpx0/ezaAXiQBnMa
X-Orig-Path: media
Cancel-Lock: sha1:J30kN50aQFHTnVvuHGFvvOSz4ys=
User-Agent: rn.py v0.0.1
 by: Andy Valencia - Fri, 10 Sep 2021 20:25 UTC

Marcel Hendrix <mhx@iae.nl> writes:
> I find 565 occurences of PICK in a total of 2077 Forth files. Of these,
> 280 are for 2 PICK, far less for 3 PICK and almost none for n > 5.

I realize that's a lot of occurrences, but when you run your eyes over
the code, do any qualities of the surrounding code jump out at you?

Andy Valencia
Home page: https://www.vsta.org/andy/
To contact me: https://www.vsta.org/contact/andy.html

Re: Not really locals

<shgpuo$1drr$1@gioia.aioe.org>

  copy mid

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

  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: Not really locals
Date: Sat, 11 Sep 2021 09:32:40 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shgpuo$1drr$1@gioia.aioe.org>
References: <f21b9830-a5fc-433e-846a-a6db1fb324cdn@googlegroups.com>
<shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<163128058713.22831.15524277815532345443@media.vsta.org>
<163130555782.30996.8901879855645684112@media.vsta.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="46971"; 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:78.0) Gecko/20100101
Thunderbird/78.14.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Fri, 10 Sep 2021 23:32 UTC

On 11/09/2021 06:25, Andy Valencia wrote:
> Marcel Hendrix <mhx@iae.nl> writes:
>> I find 565 occurences of PICK in a total of 2077 Forth files. Of these,
>> 280 are for 2 PICK, far less for 3 PICK and almost none for n > 5.
>
> I realize that's a lot of occurrences, but when you run your eyes over
> the code, do any qualities of the surrounding code jump out at you?

It does seem excessive. OTOH PICK and ROLL are so ugly they're usually not
a problem avoiding. The Honey Trap in Forth is locals as they look so
innocent and even give the impression they're doing good. It's a mistake
to say 'never ever' but in the case of locals one should really try due to
their quick and seductive path to self-destruction.

Re: Not really locals

<35ca7585-5e60-451e-af03-f6681fb19570n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:4292:: with SMTP id o18mr123600qtl.75.1631316773122;
Fri, 10 Sep 2021 16:32:53 -0700 (PDT)
X-Received: by 2002:a05:620a:1655:: with SMTP id c21mr37181qko.187.1631316772973;
Fri, 10 Sep 2021 16:32:52 -0700 (PDT)
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: Fri, 10 Sep 2021 16:32:52 -0700 (PDT)
In-Reply-To: <163128058713.22831.15524277815532345443@media.vsta.org>
Injection-Info: google-groups.googlegroups.com; posting-host=82.95.228.79; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 82.95.228.79
References: <shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com> <856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com> <1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<163128058713.22831.15524277815532345443@media.vsta.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <35ca7585-5e60-451e-af03-f6681fb19570n@googlegroups.com>
Subject: Re: Not really locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Fri, 10 Sep 2021 23:32:53 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 12
 by: Hans Bezemer - Fri, 10 Sep 2021 23:32 UTC

On Friday, September 10, 2021 at 3:31:17 PM UTC+2, Andy Valencia wrote:
> Paul Rubin <no.e...@nospam.invalid> writes:
> > People are uncomfortable with PICK even though it's presumably a Chuck
> > Moore invention. I'd expect something like POKE, writing into the stack
> > interior, would destroy the illusion the rest of the way.
> I've used pick on occasion, but never without the feeling that it was hack on
> top of some code which could have been designed better.

I used it once in a Rosetta Code example because I was in a hurry, but I'm still not proud of that. In 4tH, it is an external word, which makes it quite slow as well. But given it's primary there for porting, it's not that important.

It feels as dirty as waking up with a horrible hangover beside a puddle of vomit in the arms of some tattooed hoe with a nose piercing. Not that I'm familiar with this kind of situation. I deny everything.

Hans Bezemer

Re: Not really locals

<93a223cf-04b7-45a5-968e-fa6be2f2efe7n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:6451:: with SMTP id y78mr54742qkb.427.1631317563381;
Fri, 10 Sep 2021 16:46:03 -0700 (PDT)
X-Received: by 2002:ac8:7ca9:: with SMTP id z9mr152462qtv.187.1631317563258;
Fri, 10 Sep 2021 16:46:03 -0700 (PDT)
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: Fri, 10 Sep 2021 16:46:03 -0700 (PDT)
In-Reply-To: <87mtok1it8.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=82.95.228.79; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 82.95.228.79
References: <87mtp3ux27.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com> <f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com> <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com> <87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com> <87zgslp1pu.fsf@nightsong.com>
<7f6f1890-a829-4945-bed3-dcebfbd1aba2n@googlegroups.com> <87mtok1it8.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <93a223cf-04b7-45a5-968e-fa6be2f2efe7n@googlegroups.com>
Subject: Re: Not really locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Fri, 10 Sep 2021 23:46:03 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 15
 by: Hans Bezemer - Fri, 10 Sep 2021 23:46 UTC

On Friday, September 10, 2021 at 6:44:53 PM UTC+2, Paul Rubin wrote:
> Of course there is an easy way around it. It's just being treated as
> objectionable on grounds that I'm still trying to understand.

It's easy: read "Thinking Forth". Read it carefully - and like tasting good wine, don't gobble it down, but play with these ideas. Forth is essentially what remains after you strip a language to its bare essentials. The VM of C also has a stack - but here you are responsible for maintaing it. The VM of C also uses RPN. Here you write it straight away.

That stripping is not accidental. It was for a reason. And that's for you to still figure out.

May be now you understand why adding these things back sounds so ludricous.

Hans Bezemer

Re: Not really locals

<shgr7o$1s5e$1@gioia.aioe.org>

  copy mid

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

  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: Not really locals
Date: Sat, 11 Sep 2021 09:54:32 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shgr7o$1s5e$1@gioia.aioe.org>
References: <87mtp3ux27.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<87zgslp1pu.fsf@nightsong.com>
<7f6f1890-a829-4945-bed3-dcebfbd1aba2n@googlegroups.com>
<87mtok1it8.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="61614"; 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:78.0) Gecko/20100101
Thunderbird/78.14.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Fri, 10 Sep 2021 23:54 UTC

On 11/09/2021 02:44, Paul Rubin wrote:
> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>>> People are uncomfortable with PICK even though it's presumably a Chuck
>>> Moore invention.
>> It MOST CERTAINLY isn't: "But as to stack parameters, the stacks
>> should be shallow. On the i21 we have an on-chip stack 18
>> deep. .... But no PICK no ROLL...
>
> The i21 and other such chips came well after the invention of PICK. So
> if Moore didn't invent PICK, then who is the culprit and when did it
> happen? The NRAO document "Forth, A Problem-Oriented Language" by Moore
> and Rather (https://library.nrao.edu/public/memos/comp/CDIR_11.pdf
> sec. 3.2, start near bottom of page 18 of the pdf, split across a
> table), says:
>
> Several words have been defined in basic FORTH for manipulating the
> stack. summarized in the table. The operation of these words is A
> fairly standard set of more complicated stack operators is available
> in some developed applications, for such things as double precision
> numbers, fetching numbers several levels down in the stack, etc.
>
> The document itself doesn't describe PICK, but that paragraph seems to
> say that someone needed it for an application so they implemented it.
> Who was writing such applications in that era? What should they have
> done instead, if they found the builtins (missing PICK at the time)
> insufficient for getting their work done?

PICK and ROLL appear in KPF dated 1979 (long after Moore had left).
When used by a novice, they're almost certainly a mistake; for adept
forthers they can be the lesser of two evils.

Re: Not really locals

<shh1t6$gq$1@gioia.aioe.org>

  copy mid

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

  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: Not really locals
Date: Sat, 11 Sep 2021 11:48:22 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shh1t6$gq$1@gioia.aioe.org>
References: <87mtp3ux27.fsf@nightsong.com>
<842e2f23-e787-4aa6-a90c-8874891e1d9en@googlegroups.com>
<87o897sn3l.fsf@nightsong.com> <sh1j5u$gdi$1@gioia.aioe.org>
<87k0jvscg0.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<87zgslp1pu.fsf@nightsong.com>
<7f6f1890-a829-4945-bed3-dcebfbd1aba2n@googlegroups.com>
<shfj0m$plm$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="538"; 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:78.0) Gecko/20100101
Thunderbird/78.14.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sat, 11 Sep 2021 01:48 UTC

On 10/09/2021 22:28, dxforth wrote:
>
> FWIW the app I recently posted breaks down as follows:
>
> #colon defs: #inputs:
> 100 0
> 26 1
> 16 2
> 9 3
> 1 4
>
> While I have PICK and ROLL I had no cause to use them in this instance.

To complete the picture here is a count of the stack operators used:

DUP 58
DROP 27
SWAP 22
OVER 15
ROT 8
NIP 1
PICK 0
ROLL 0

2DROP 8
2DUP 3
2NIP 2
2SWAP 1
2OVER 0
2ROT 0

Stack-jugglers i.e. two or more stack operations in sequence:

ROT OVER 1
DUP ROT 1
DUP 2SWAP 1
2NIP NIP 1

Re: Not really locals

<87czpf8yfc.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!rocksolid2!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: Not really locals
Date: Fri, 10 Sep 2021 22:37:59 -0700
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <87czpf8yfc.fsf@nightsong.com>
References: <shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<163128058713.22831.15524277815532345443@media.vsta.org>
<35ca7585-5e60-451e-af03-f6681fb19570n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="da91a898d9d330737fa437c293fb8b27";
logging-data="27749"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QoZ3iwEoQjq/ZZJw2mPDT"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:uUczWXAzJ+eJd9s9WIkX2VdNkio=
sha1:cHXO1+nozR52FLH+p3yW5czUr18=
 by: Paul Rubin - Sat, 11 Sep 2021 05:37 UTC

Hans Bezemer <the.beez.speaks@gmail.com> writes:
> I used it once in a Rosetta Code example because I was in a hurry, but
> I'm still not proud of that. In 4tH, it is an external word, which
> makes it quite slow as well. But given it's primary there for porting,
> it's not that important.

I needed to copy the top 3 stack elements (3DUP) to try the Tak
benchmark. I wrote something like:

: 3dup.1 ( a b c -- a b c a b c ) >r 2dup r@ -rot r> ;

I sent the benchmark to Mattias Trute and he said he had already done
this test, and sent his version. It used:

: 3dup.2 ( a b c -- a b c a b c ) 2 pick 2 pick 2 pick ;

That seemed simpler to me. Of course with locals,

: 3dup.3 { a b c } a b c a b c ;

is as simple as it gets.

Re: Not really locals

<878s038yc2.fsf@nightsong.com>

  copy mid

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

  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: Not really locals
Date: Fri, 10 Sep 2021 22:39:57 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <878s038yc2.fsf@nightsong.com>
References: <87mtp3ux27.fsf@nightsong.com> <sh4osq$9sn$1@gioia.aioe.org>
<877dftspq8.fsf@nightsong.com> <sh6f2p$h91$1@gioia.aioe.org>
<8735qhrvla.fsf@nightsong.com> <sh6l4t$ic9$1@gioia.aioe.org>
<87y289q9m7.fsf@nightsong.com>
<f8d0fd68-4b05-4e0b-b043-430abed3dfa5n@googlegroups.com>
<87h7ev6832.fsf@nightsong.com> <sh9gfq$ebl$1@gioia.aioe.org>
<87y287qy7c.fsf@nightsong.com> <shapgj$1a32$1@gioia.aioe.org>
<87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com>
<856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com>
<1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<87zgslp1pu.fsf@nightsong.com>
<7f6f1890-a829-4945-bed3-dcebfbd1aba2n@googlegroups.com>
<87mtok1it8.fsf@nightsong.com>
<93a223cf-04b7-45a5-968e-fa6be2f2efe7n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="da91a898d9d330737fa437c293fb8b27";
logging-data="27749"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1980p40Utmla9+efqXgrIeV"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:EU0l4oKgIKtw0SoTAz4QUF91ras=
sha1:8V2PbG4QlJMIAMcg2iaLuDFySps=
 by: Paul Rubin - Sat, 11 Sep 2021 05:39 UTC

Hans Bezemer <the.beez.speaks@gmail.com> writes:
> It's easy: read "Thinking Forth". Read it carefully

I have read it, I have been wanting to look at again, but I don't
remember it saying anything about this.

> The VM of C also has a stack - but here you are responsible for
> maintaing it. The VM of C also uses RPN. Here you write it straight
> away.

The VM of C has no issues with reaching into the stack interior. That's
how automatic variables work in C. What is so terrible about doing that
in Forth?

> May be now you understand why adding these things back sounds so ludricous.

Not yet, anyway.

Re: Not really locals

<2021Sep11.083507@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Not really locals
Date: Sat, 11 Sep 2021 06:35:07 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 44
Message-ID: <2021Sep11.083507@mips.complang.tuwien.ac.at>
References: <shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com> <6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com> <856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com> <87k0jpr6sd.fsf@nightsong.com> <1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com> <163128058713.22831.15524277815532345443@media.vsta.org> <35ca7585-5e60-451e-af03-f6681fb19570n@googlegroups.com> <87czpf8yfc.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="3d5262018b827ebdf3dd89c43615c414";
logging-data="21139"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PaVRpnMgW9L+F4AZjrlPJ"
Cancel-Lock: sha1:UqSCAtcI1tn3HXEJ+Q4wQ4sRhaw=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 11 Sep 2021 06:35 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>I needed to copy the top 3 stack elements (3DUP) to try the Tak
>benchmark. I wrote something like:
>
> : 3dup.1 ( a b c -- a b c a b c ) >r 2dup r@ -rot r> ;
>
>I sent the benchmark to Mattias Trute and he said he had already done
>this test, and sent his version. It used:
>
> : 3dup.2 ( a b c -- a b c a b c ) 2 pick 2 pick 2 pick ;
>
>That seemed simpler to me. Of course with locals,
>
> : 3dup.3 { a b c } a b c a b c ;
>
>is as simple as it gets.

On lxf all three produce the same code:

804FC0A 8B4500 mov eax , [ebp]
804FC0D 8945F4 mov [ebp-Ch] , eax
804FC10 8B4504 mov eax , [ebp+4h]
804FC13 8945F8 mov [ebp-8h] , eax
804FC16 895DFC mov [ebp-4h] , ebx
804FC19 8D6DF4 lea ebp , [ebp-Ch]
804FC1C C3 ret near

You are not going to factor this further, so the factoring
disadvantage of the return stack and the locals version does not play
a role. So use whatever you like most. On VFX 3DUP.2 produces
equally good code, the other versions are worse.

I find it funny that those who disapprove of some Forth features do
not give any concrete reasons for that. Instead, they use evocative
language, and point people to books, without pointing out any specific
place the should read. There are not many clearer ways to indicate
their lack of arguments.

- 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: Not really locals

<66eb46ed-d0dd-4084-8459-461780e203c8n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:2297:: with SMTP id o23mr1029527qkh.405.1631345992385;
Sat, 11 Sep 2021 00:39:52 -0700 (PDT)
X-Received: by 2002:a05:622a:1911:: with SMTP id w17mr1296208qtc.228.1631345992226;
Sat, 11 Sep 2021 00:39:52 -0700 (PDT)
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: Sat, 11 Sep 2021 00:39:52 -0700 (PDT)
In-Reply-To: <163130555782.30996.8901879855645684112@media.vsta.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:d1aa:4aad:e603:6aa2;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:d1aa:4aad:e603:6aa2
References: <f21b9830-a5fc-433e-846a-a6db1fb324cdn@googlegroups.com>
<shapgj$1a32$1@gioia.aioe.org> <87o892rgny.fsf@nightsong.com>
<6a752f87-db15-4fd6-bf0b-c26df8e294den@googlegroups.com> <856ed583-8868-43db-9059-7d1eb8754e02n@googlegroups.com>
<87k0jpr6sd.fsf@nightsong.com> <1edac439-8805-4283-b64c-7f1490a53277n@googlegroups.com>
<163128058713.22831.15524277815532345443@media.vsta.org> <163130555782.30996.8901879855645684112@media.vsta.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <66eb46ed-d0dd-4084-8459-461780e203c8n@googlegroups.com>
Subject: Re: Not really locals
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Sat, 11 Sep 2021 07:39:52 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 32
 by: Marcel Hendrix - Sat, 11 Sep 2021 07:39 UTC

On Friday, September 10, 2021 at 10:26:57 PM UTC+2, Andy Valencia wrote:
> Marcel Hendrix <m...@iae.nl> writes:
> > I find 565 occurences of PICK in a total of 2077 Forth files. Of these,
> > 280 are for 2 PICK, far less for 3 PICK and almost none for n > 5.
> I realize that's a lot of occurrences, but when you run your eyes over
> the code, do any qualities of the surrounding code jump out at you?

A very difficult question. Maybe 20% of the usage is caused by
benchmarks and published code, something one does not really
want to rewrite from scratch.

I looked at some of the others: it would be a major effort to get rid
of the 2..4 PICK's (replacing them with convoluted stack gymnastics
is of course always possible). Although I don't believe in THIRD and
FOURTH, that may be just because there names are odd.

There appear to be many occurences of strings ( c-addr u -- ) and
doubles ( lo hi -- ). The number of objects may be less than 3,
but with strings and doubles that grows to 6 stack items.

The PICKs are almost always accompanied by locals. So 2 .. 4 PICK
is apparently preferred to locals.

When code is reused, it is with the purpose to add features and
therefore extra parameters need to be introduced. Rewriting is
obviously not wanted.

When working with others it is not productive to completely
rewrite your colleague's code just to get rid of a stack item. (I did
not find many examples of that, probably because the interface
was fixed or because locals were unavoidable anyway.)

-marcel

Pages:1234567
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor