Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A woman should have compassion. -- Kirk, "Catspaw", stardate 3018.2


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

<f1da7e8d-2ed0-4693-b01f-e7cbf1a1d683n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ad4:5630:: with SMTP id cb16mr1158601qvb.45.1631347015304;
Sat, 11 Sep 2021 00:56:55 -0700 (PDT)
X-Received: by 2002:a05:622a:1aaa:: with SMTP id s42mr1277970qtc.122.1631347015061;
Sat, 11 Sep 2021 00:56:55 -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:56:54 -0700 (PDT)
In-Reply-To: <66eb46ed-d0dd-4084-8459-461780e203c8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f0f:8f33:b549:c77:4be5:e408;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f0f:8f33:b549:c77:4be5:e408
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>
<66eb46ed-d0dd-4084-8459-461780e203c8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f1da7e8d-2ed0-4693-b01f-e7cbf1a1d683n@googlegroups.com>
Subject: Re: Not really locals
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Sat, 11 Sep 2021 07:56:55 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 34
 by: minf...@arcor.de - Sat, 11 Sep 2021 07:56 UTC

Marcel Hendrix schrieb am Samstag, 11. September 2021 um 09:39:53 UTC+2:
> 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.)
>

I think that nails it down. It is sometimes difficult to avoid PICK when you have
mixed single cell and double cell arguments.

Re: Not really locals

<shibtq$16uo$1@gioia.aioe.org>

  copy mid

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

  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 23:45:30 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shibtq$16uo$1@gioia.aioe.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>
<163128058713.22831.15524277815532345443@media.vsta.org>
<35ca7585-5e60-451e-af03-f6681fb19570n@googlegroups.com>
<87czpf8yfc.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="39896"; 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 - Sat, 11 Sep 2021 13:45 UTC

On 11/09/2021 15:37, Paul Rubin wrote:
> 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.
>

Also the longest and worst performing.

: 3DUP.4 DUP 2OVER ROT ;

On my system the results were as follows:

3dup.2 12/17 time/bytes
3dup.3 25/26
3dup.4 7/11

Re: Not really locals

<163137265769.22997.11595624535408629317@media.vsta.org>

  copy mid

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

  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: Sat, 11 Sep 2021 08:04:17 -0700
Lines: 13
Message-ID: <163137265769.22997.11595624535408629317@media.vsta.org>
References: <66eb46ed-d0dd-4084-8459-461780e203c8n@googlegroups.com> <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>
X-Trace: individual.net RLJRhre8MONjfAWFsFfk1wQ2ix/cfScwOC7btT+WC/5CGLzOiM
X-Orig-Path: media
Cancel-Lock: sha1:mTjwLDGhZ26I/VU/8Qg5qDtt/7g=
User-Agent: rn.py v0.0.1
 by: Andy Valencia - Sat, 11 Sep 2021 15:04 UTC

Marcel Hendrix <mhx@iae.nl> writes:
> > 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.
> ...

Thank you for that discussion, it was very interesting.

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

Re: Not really locals

<bc6eb58d-edc6-4ae7-ab94-9ee0408714f7n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a0c:d412:: with SMTP id t18mr2923009qvh.53.1631376097207;
Sat, 11 Sep 2021 09:01:37 -0700 (PDT)
X-Received: by 2002:a05:620a:2a14:: with SMTP id o20mr2587182qkp.286.1631376097029;
Sat, 11 Sep 2021 09:01:37 -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 09:01:36 -0700 (PDT)
In-Reply-To: <f21b9830-a5fc-433e-846a-a6db1fb324cdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:e989:8ca0:dc8e:1232;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:e989:8ca0:dc8e:1232
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>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bc6eb58d-edc6-4ae7-ab94-9ee0408714f7n@googlegroups.com>
Subject: Re: Not really locals
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Sat, 11 Sep 2021 16:01:37 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 8
 by: S Jack - Sat, 11 Sep 2021 16:01 UTC

On Friday, September 10, 2021 at 11:46:54 AM UTC-5, Marcel Hendrix wrote:
> Some call these THIRD and FOURTH, but for me that make no sense.
> (DUP <= ONE, OVER <= SECOND ?)

>
They were in Baden's Toolbelt along with note stating they
should be primitives.
--
me

Re: Not really locals

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

  copy mid

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

  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 19:50:52 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 46
Message-ID: <2021Sep11.215052@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> <shibtq$16uo$1@gioia.aioe.org>
Injection-Info: reader02.eternal-september.org; posting-host="3d5262018b827ebdf3dd89c43615c414";
logging-data="10777"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ETUpCSe5X6ir/5x0jHq1G"
Cancel-Lock: sha1:0mnjt1BNv7qusFDm3HApCogHZbo=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 11 Sep 2021 19:50 UTC

dxforth <dxforth@gmail.com> writes:
>On 11/09/2021 15:37, Paul Rubin wrote:
>> : 3dup.2 ( a b c -- a b c a b c ) 2 pick 2 pick 2 pick ;
>: 3DUP.4 DUP 2OVER ROT ;

Gforth-fast AMD64:

see-code 3dup.2 see-code 3dup.4
$7FE5CCD711A8 third $7FE5CCD71278 dup
7FE5CC966626: mov rax,$10[r13] 7FE5CC966714: sub r13,$08
7FE5CC96662A: sub r13,$08 7FE5CC966718: add r14,$08
7FE5CC96662E: add r14,$08 7FE5CC96671C: mov $08[r13],r15
7FE5CC966632: mov $08[r13],r15 $7FE5CCD71280 2over
7FE5CC966636: mov r15,rax 7FE5CC966720: mov rax,$10[r13]
$7FE5CCD711B0 third 7FE5CC966724: mov rdx,$18[r13]
7FE5CC966639: mov rax,$10[r13] 7FE5CC966728: sub r13,$10
7FE5CC96663D: sub r13,$08 7FE5CC96672C: add r14,$08
7FE5CC966641: add r14,$08 7FE5CC966730: mov $10[r13],r15
7FE5CC966645: mov $08[r13],r15 7FE5CC966734: mov $08[r13],rdx
7FE5CC966649: mov r15,rax 7FE5CC966738: mov r15,rax
$7FE5CCD711B8 third $7FE5CCD71288 rot
7FE5CC96664C: mov rax,$10[r13] 7FE5CC96673B: mov rax,$10[r13]
7FE5CC966650: sub r13,$08 7FE5CC96673F: mov rdx,$08[r13]
7FE5CC966654: add r14,$08 7FE5CC966743: add r14,$08
7FE5CC966658: mov $08[r13],r15 7FE5CC966747: mov $08[r13],r15
7FE5CC96665C: mov r15,rax 7FE5CC96674B: mov $10[r13],rdx
$7FE5CCD711C0 ;s ok 7FE5CC96674F: mov r15,rax
$7FE5CCD71290 ;s ok

And of course, lxf produces the same code for 3dup.4 as for all the
other versions:

804FC1D 8B4500 mov eax , [ebp]
804FC20 8945F4 mov [ebp-Ch] , eax
804FC23 8B4504 mov eax , [ebp+4h]
804FC26 8945F8 mov [ebp-8h] , eax
804FC29 895DFC mov [ebp-4h] , ebx
804FC2C 8D6DF4 lea ebp , [ebp-Ch]
804FC2F C3 ret near

- 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

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

  copy mid

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

  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 20:23:20 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 36
Message-ID: <2021Sep11.222320@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> <shibtq$16uo$1@gioia.aioe.org> <2021Sep11.215052@mips.complang.tuwien.ac.at>
Injection-Info: reader02.eternal-september.org; posting-host="3d5262018b827ebdf3dd89c43615c414";
logging-data="5610"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191dzRVOjGnBBqOwnXXNq2n"
Cancel-Lock: sha1:L0QtjAkZILzkt+SGjzq9Bb+g5Ro=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sat, 11 Sep 2021 20:23 UTC

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>And of course, lxf produces the same code for 3dup.4 as for all the
>other versions:
>
> 804FC1D 8B4500 mov eax , [ebp]
> 804FC20 8945F4 mov [ebp-Ch] , eax
> 804FC23 8B4504 mov eax , [ebp+4h]
> 804FC26 8945F8 mov [ebp-8h] , eax
> 804FC29 895DFC mov [ebp-4h] , ebx
> 804FC2C 8D6DF4 lea ebp , [ebp-Ch]
> 804FC2F C3 ret near

And the reason is that all four versions consist only of words that
lxf analyses at compile time, so all four versions result in zero
stuff to compile right away, and the same stack state to reconcile
with the calling convention, so the same code is generated (which
consists entirely of the reconciliation with the calling convention).

Likewise, VFX produces the same code for 3dup.2 and 3dup.4; it
produces different (but equivalent) code for the reconciliation
compared to lxf.

VFX produces worse code for 3dup.1 because it is not analytical about
the return stack; so when it encounters a return stack word, it has to
generate code for the return stack word, and that also restricts how
the data stack reconciliation can work.

Likewise, VFX produces worse code for 3dup.3 because it is not
analytical about locals.

- 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

<871r5u936m.fsf@nightsong.com>

  copy mid

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

  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: Sat, 11 Sep 2021 15:07:29 -0700
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <871r5u936m.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>
<87czpf8yfc.fsf@nightsong.com> <shibtq$16uo$1@gioia.aioe.org>
<2021Sep11.215052@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="ba54d55f56f7c6ebe10fbd14de294cd6";
logging-data="11293"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/94mCMTdofFrwpbDraTMdV"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:aYTj+58w/m6S2Wp0kJvXcf/ZWXY=
sha1:mqetFQ/bNebjeRD2dhJqBHMPEdA=
 by: Paul Rubin - Sat, 11 Sep 2021 22:07 UTC

>>> : 3dup.2 ( a b c -- a b c a b c ) 2 pick 2 pick 2 pick ;
>>: 3DUP.4 DUP 2OVER ROT ;
> Gforth-fast AMD64: ...

Gforth-fast uses big and fast enough hardware that the cost of locals
(if any) with it will almost always be negligible. On a tiny bytecode
implementation, 3dup.4 is very clever and impressive (probably just 3
bytes). It makes me think that if locals are supported for it, then the
compiler should do some work to avoid copying them around, when
possible.

Re: Not really locals

<9460b63b-1e3a-40e9-ba7d-b9b6bcb22a1dn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:da:: with SMTP id d26mr3589661qtg.401.1631398133489;
Sat, 11 Sep 2021 15:08:53 -0700 (PDT)
X-Received: by 2002:a0c:ca85:: with SMTP id a5mr3904892qvk.64.1631398133287;
Sat, 11 Sep 2021 15:08: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: Sat, 11 Sep 2021 15:08:53 -0700 (PDT)
In-Reply-To: <2021Sep11.222320@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:2000:2001:971:e1c8:7066:f8d9:5e45;
posting-account=ryzhhAoAAAAIqf1uqmG9E4uP1Bagd-k2
NNTP-Posting-Host: 2a01:2000:2001:971:e1c8:7066:f8d9:5e45
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> <shibtq$16uo$1@gioia.aioe.org>
<2021Sep11.215052@mips.complang.tuwien.ac.at> <2021Sep11.222320@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9460b63b-1e3a-40e9-ba7d-b9b6bcb22a1dn@googlegroups.com>
Subject: Re: Not really locals
From: peter.m....@gmail.com (P Falth)
Injection-Date: Sat, 11 Sep 2021 22:08:53 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 67
 by: P Falth - Sat, 11 Sep 2021 22:08 UTC

On Saturday, 11 September 2021 at 23:09:03 UTC+2, Anton Ertl wrote:
> an...@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> >And of course, lxf produces the same code for 3dup.4 as for all the
> >other versions:
> >
> > 804FC1D 8B4500 mov eax , [ebp]
> > 804FC20 8945F4 mov [ebp-Ch] , eax
> > 804FC23 8B4504 mov eax , [ebp+4h]
> > 804FC26 8945F8 mov [ebp-8h] , eax
> > 804FC29 895DFC mov [ebp-4h] , ebx
> > 804FC2C 8D6DF4 lea ebp , [ebp-Ch]
> > 804FC2F C3 ret near
> And the reason is that all four versions consist only of words that
> lxf analyses at compile time, so all four versions result in zero
> stuff to compile right away, and the same stack state to reconcile
> with the calling convention, so the same code is generated (which
> consists entirely of the reconciliation with the calling convention).

Yes this is correct. But it does not analyse the code. Stack operations
just move pointers on a virtual stack, no code is generated. When code
needs to be generated the locations of the stack items are taken from
the virtual stacks and appropriate code are generated. In this case as
you point out code is generated by ; as the function needs to leave the
stack in a known state. Both the data and return stacks are treated in the
same way. Locals are placed on the return stack, the code generator
does not handle them in any specific way. In fact it is unaware of them.

As you have seen to generate good code any points that needs to
reconcile the stacks should be avoided. That is why inlining to avoid
calls gets interesting.

In the example of the rectangle where lxf generated less good code
this happened. The code could be written in this way to improve
: preprect {: x1 y1 x2 y2 :} x1 y1 x1 y2 x2 y2 x2 y1 x1 y1 ; ok
: rect4 preprect moveto lineto lineto lineto lineto ;

the preprect will generate 43 bytes of stack shuffling and rect4
30 bytes of calls ( 5 calls and one tail jump).

doing the same for the stack shuffling variant saves even more
: rect5 2over 2>r 2>r over r@ 2r> over r@ 2r>
moveto lineto lineto lineto lineto ;

This will generate 67 bytes, saving one call and one ret.

Of course this is a stupid way of actually writing it. But if you want to
see what can be achived you will do it.

BR
Peter

> Likewise, VFX produces the same code for 3dup.2 and 3dup.4; it
> produces different (but equivalent) code for the reconciliation
> compared to lxf.
>
> VFX produces worse code for 3dup.1 because it is not analytical about
> the return stack; so when it encounters a return stack word, it has to
> generate code for the return stack word, and that also restricts how
> the data stack reconciliation can work.
>
> Likewise, VFX produces worse code for 3dup.3 because it is not
> analytical about locals.
> - 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

<3255ae60-2ba6-43b3-b1e6-7edf7031a4e6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:57d1:: with SMTP id w17mr3763981qta.138.1631400918061;
Sat, 11 Sep 2021 15:55:18 -0700 (PDT)
X-Received: by 2002:a05:620a:9c9:: with SMTP id y9mr3636163qky.207.1631400917898;
Sat, 11 Sep 2021 15:55:17 -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: Sat, 11 Sep 2021 15:55:17 -0700 (PDT)
In-Reply-To: <2021Sep11.083507@mips.complang.tuwien.ac.at>
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> <35ca7585-5e60-451e-af03-f6681fb19570n@googlegroups.com>
<87czpf8yfc.fsf@nightsong.com> <2021Sep11.083507@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3255ae60-2ba6-43b3-b1e6-7edf7031a4e6n@googlegroups.com>
Subject: Re: Not really locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Sat, 11 Sep 2021 22:55:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 65
 by: Hans Bezemer - Sat, 11 Sep 2021 22:55 UTC

On Saturday, September 11, 2021 at 8:54:06 AM UTC+2, Anton Ertl wrote:
> Paul Rubin <no.e...@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

Philosophy goes deep. It's not something that fits half a page - as the people who do know most certainly do. However, those who have a notion of design know that software unrevels and decays in two particular instances:
a) Maintenance on software without an explicit design and architecture;
b) Maintenance on software which does not respect an explicit design and architecture.

Moore has always been very vocal on what this design and philosophy was. And it has been very well expressed in Thinking Forth and the fire chats. Violating it almost killed Forth in 1983. But people never learn.

I know of a lot of managers who find themselves extra ordinary "pragmatic" and are arrogant enough to think they can violate the rules and get away with it.

Most of the time however, reality wins. Or do you think it's a smart move to do ducktyping by design and then add all kinds of type checking functionality all of a sudden? Especially when you always stated "there is alaways one obvious way to do it"? Does that consitute a clear vision?

Hans Bezemer

Re: Not really locals

<shjm2q$1hj8$1@gioia.aioe.org>

  copy mid

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

  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: Sun, 12 Sep 2021 11:44:57 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shjm2q$1hj8$1@gioia.aioe.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>
<163128058713.22831.15524277815532345443@media.vsta.org>
<35ca7585-5e60-451e-af03-f6681fb19570n@googlegroups.com>
<87czpf8yfc.fsf@nightsong.com> <shibtq$16uo$1@gioia.aioe.org>
<2021Sep11.215052@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="50792"; 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
X-Mozilla-News-Host: news://nntp.aioe.org
 by: dxforth - Sun, 12 Sep 2021 01:44 UTC

On 12/09/2021 05:50, Anton Ertl wrote:
> dxforth <dxforth@gmail.com> writes:
>>On 11/09/2021 15:37, Paul Rubin wrote:
>>> : 3dup.2 ( a b c -- a b c a b c ) 2 pick 2 pick 2 pick ;
>>: 3DUP.4 DUP 2OVER ROT ;
>
> Gforth-fast AMD64:
>
> see-code 3dup.2 see-code 3dup.4
> $7FE5CCD711A8 third $7FE5CCD71278 dup
> 7FE5CC966626: mov rax,$10[r13] 7FE5CC966714: sub r13,$08
> 7FE5CC96662A: sub r13,$08 7FE5CC966718: add r14,$08
> 7FE5CC96662E: add r14,$08 7FE5CC96671C: mov $08[r13],r15
> 7FE5CC966632: mov $08[r13],r15 $7FE5CCD71280 2over
> 7FE5CC966636: mov r15,rax 7FE5CC966720: mov rax,$10[r13]
> $7FE5CCD711B0 third 7FE5CC966724: mov rdx,$18[r13]
> 7FE5CC966639: mov rax,$10[r13] 7FE5CC966728: sub r13,$10
> 7FE5CC96663D: sub r13,$08 7FE5CC96672C: add r14,$08
> 7FE5CC966641: add r14,$08 7FE5CC966730: mov $10[r13],r15
> 7FE5CC966645: mov $08[r13],r15 7FE5CC966734: mov $08[r13],rdx
> 7FE5CC966649: mov r15,rax 7FE5CC966738: mov r15,rax
> $7FE5CCD711B8 third $7FE5CCD71288 rot
> 7FE5CC96664C: mov rax,$10[r13] 7FE5CC96673B: mov rax,$10[r13]
> 7FE5CC966650: sub r13,$08 7FE5CC96673F: mov rdx,$08[r13]
> 7FE5CC966654: add r14,$08 7FE5CC966743: add r14,$08
> 7FE5CC966658: mov $08[r13],r15 7FE5CC966747: mov $08[r13],r15
> 7FE5CC96665C: mov r15,rax 7FE5CC96674B: mov $10[r13],rdx
> $7FE5CCD711C0 ;s ok 7FE5CC96674F: mov r15,rax
> $7FE5CCD71290 ;s ok

Few non-optimizing compilers define THIRD presumably as they had PICK
and '2 PICK' doesn't arise that often. The only regular stack word I
have based on PICK or ROLL is 2ROT - again because it's not used that
often despite being 'standard'.

> VFX produces worse code for 3dup.1 because it is not analytical about
> the return stack [...] Likewise [...] locals.

I actually agree with that. A forth programmer expects to get what he
writes - 'close to the metal' and all that. If one has no control over
output one may as well use C.

Re: Not really locals

<87o88y7duy.fsf@nightsong.com>

  copy mid

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

  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: Sat, 11 Sep 2021 18:59:49 -0700
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <87o88y7duy.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>
<87czpf8yfc.fsf@nightsong.com>
<2021Sep11.083507@mips.complang.tuwien.ac.at>
<3255ae60-2ba6-43b3-b1e6-7edf7031a4e6n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="ba54d55f56f7c6ebe10fbd14de294cd6";
logging-data="22153"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pdiDjYn0VgEoLEDD3Qbcw"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:ixgXU8eO4dYuj2DYJU1Zew6DLIg=
sha1:g+K+ZKhNZwbpryEnExfgszs1xC4=
 by: Paul Rubin - Sun, 12 Sep 2021 01:59 UTC

Hans Bezemer <the.beez.speaks@gmail.com> writes:
> Moore has always been very vocal on what this design and philosophy
> was. And it has been very well expressed in Thinking Forth and the
> fire chats.

I looked for info about this in Thinking Forth (ANS edition) and
couldn't find any. Can you suggest an edition and page number to check?

> Violating it almost killed Forth in 1983. But people never learn.

Forth is fairly dead right now. Maybe the unneeded stack juggling is
a contributing factor.

> Most of the time however, reality wins. Or do you think it's a smart
> move to do ducktyping by design and then add all kinds of type
> checking functionality all of a sudden? Especially when you always
> stated "there is alaways one obvious way to do it"? Does that
> consitute a clear vision?

Are you talking about MyPy? I use it and I think it does some good,
though you are right that it is imperfect as an add-on. There are
similar things for Erlang (the Dialyzer), typed Clojure, typed Racket,
and a general topic called "gradual typing" for such things. In each
case, they seem to help. It seems to me that latent/duck typing works
best for relatively small programs, and static types become worth their
weight in larger programs.

Python started out as a small scripting language that eventually came to
host larger systems, so it started creaking under the load, and type
annotations were added to help with that. Ruby has something similar
now too. There are other problems with Python that also resulted from
"thinking small" at first.

If we're looking for lessons from all this, one lesson might be to think
big from the beginning, like ML did and Haskell sort-of did. Forth has
always been the opposite of that, though that is part of what makes it
interesting.

Re: Not really locals

<shjpbp$k9l$1@gioia.aioe.org>

  copy mid

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

  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: Sun, 12 Sep 2021 12:40:56 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shjpbp$k9l$1@gioia.aioe.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>
<163128058713.22831.15524277815532345443@media.vsta.org>
<35ca7585-5e60-451e-af03-f6681fb19570n@googlegroups.com>
<87czpf8yfc.fsf@nightsong.com> <2021Sep11.083507@mips.complang.tuwien.ac.at>
<3255ae60-2ba6-43b3-b1e6-7edf7031a4e6n@googlegroups.com>
<87o88y7duy.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="20789"; 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 - Sun, 12 Sep 2021 02:40 UTC

On 12/09/2021 11:59, Paul Rubin wrote:
> Hans Bezemer <the.beez.speaks@gmail.com> writes:
>> Moore has always been very vocal on what this design and philosophy
>> was. And it has been very well expressed in Thinking Forth and the
>> fire chats.
>
> I looked for info about this in Thinking Forth (ANS edition) and
> couldn't find any. Can you suggest an edition and page number to check?
>
>> Violating it almost killed Forth in 1983. But people never learn.
>
> Forth is fairly dead right now.

So is stamp collecting. It makes no difference to those who are
passionate about it.

Re: Not really locals

<87k0jm6zou.fsf@nightsong.com>

  copy mid

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

  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: Sun, 12 Sep 2021 00:05:53 -0700
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <87k0jm6zou.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>
<87czpf8yfc.fsf@nightsong.com> <shibtq$16uo$1@gioia.aioe.org>
<2021Sep11.215052@mips.complang.tuwien.ac.at>
<2021Sep11.222320@mips.complang.tuwien.ac.at>
<9460b63b-1e3a-40e9-ba7d-b9b6bcb22a1dn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="ba54d55f56f7c6ebe10fbd14de294cd6";
logging-data="25687"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vlnAcKGRkMRDZWkj8Bvel"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:koXF9RuxzoG+xcOIcT1X23HIVPE=
sha1:g7kkvC4AlERGa89EGw/v0cMksaA=
 by: Paul Rubin - Sun, 12 Sep 2021 07:05 UTC

P Falth <peter.m.falth@gmail.com> writes:
> Stack operations just move pointers on a virtual stack, no code is
> generated. When code needs to be generated the locations of the stack
> items are taken from the virtual stacks and appropriate code are
> generated.... As you have seen to generate good code any points that
> needs to reconcile the stacks should be avoided. That is why inlining
> to avoid calls gets interesting.

Peter, can you say anything about the subtleties of these operations?
Do you compile every word separately, i.e. starting with with no
knowledge of the stack state other than from the word definition? If
you have to reconcile the stack at the end, do you just put it into the
state that a normal Forth interpreter would leave it in, or do you
possibly make adjustments depending on the definitions of other words?

If you compile FOO and that has some reconciliation at the end, and
later BAR uses FOO's output but might have been better off starting from
an intermediate state of FOO, then maybe the inlined FOO BAR would allow
some reconciliation and rearrangement to "cancel out". Is this useful?

Would you say this virtual stack stuff was complicated to implement? I
know of several compilers that do it, but I haven't examined them. I
think the approach could be useful for something I've gotten interested
in, but I don't know what I'd be getting into if I attempted it. Thanks.

Re: Not really locals

<d7c85a4e-65fd-4460-bfbd-af81d3d6e55bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7b4a:: with SMTP id m10mr4766220qtu.121.1631434185968;
Sun, 12 Sep 2021 01:09:45 -0700 (PDT)
X-Received: by 2002:ac8:7f52:: with SMTP id g18mr4578802qtk.169.1631434185696;
Sun, 12 Sep 2021 01:09:45 -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: Sun, 12 Sep 2021 01:09:45 -0700 (PDT)
In-Reply-To: <87k0jm6zou.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:2000:2001:e4d:642c:59bb:d29:59b1;
posting-account=ryzhhAoAAAAIqf1uqmG9E4uP1Bagd-k2
NNTP-Posting-Host: 2a01:2000:2001:e4d:642c:59bb:d29:59b1
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> <shibtq$16uo$1@gioia.aioe.org>
<2021Sep11.215052@mips.complang.tuwien.ac.at> <2021Sep11.222320@mips.complang.tuwien.ac.at>
<9460b63b-1e3a-40e9-ba7d-b9b6bcb22a1dn@googlegroups.com> <87k0jm6zou.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d7c85a4e-65fd-4460-bfbd-af81d3d6e55bn@googlegroups.com>
Subject: Re: Not really locals
From: peter.m....@gmail.com (P Falth)
Injection-Date: Sun, 12 Sep 2021 08:09:45 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 55
 by: P Falth - Sun, 12 Sep 2021 08:09 UTC

On Sunday, 12 September 2021 at 09:05:56 UTC+2, Paul Rubin wrote:
> P Falth <peter....@gmail.com> writes:
> > Stack operations just move pointers on a virtual stack, no code is
> > generated. When code needs to be generated the locations of the stack
> > items are taken from the virtual stacks and appropriate code are
> > generated.... As you have seen to generate good code any points that
> > needs to reconcile the stacks should be avoided. That is why inlining
> > to avoid calls gets interesting.
> Peter, can you say anything about the subtleties of these operations?
> Do you compile every word separately, i.e. starting with with no
> knowledge of the stack state other than from the word definition? If
> you have to reconcile the stack at the end, do you just put it into the
> state that a normal Forth interpreter would leave it in, or do you
> possibly make adjustments depending on the definitions of other words?

I have to words that control the virtual stacks. v-init ( n --) and v-exit ( n-- )
the argument tells how many stack items to keep in registers.
When stating a new definition with : 1 v-init is issued and at the exit 1 v-exit
This means that every "normal" word that a user compiles stats with
top of stack in ebx and also ends in the same way. When ther is a control flow
break ( if begin then etc) the stack must be set to a know state with 1 v-exit.
The same if a call to a previously compiled word is done.
Early on I tried to be smarter and had a in/out ( n1 n2 -- ) word that
described and stored how many stackitems to keep in registers.
After some testing it was clear that this in the end produced more stack juggling
then just 1 item in a register. more code also meant a bit slower.

For this reason inlining becomes a very important means to improve code
as this avoids reconciliation on calls as they are removed. Best and easiest
is just a simple source inlining. But this of course has a problem of late binding
and possibility of redifinitions and wordlist order. In my 64 bit lxf64 I compile
first to tokenthreaded code to solve this problem

> If you compile FOO and that has some reconciliation at the end, and
> later BAR uses FOO's output but might have been better off starting from
> an intermediate state of FOO, then maybe the inlined FOO BAR would allow
> some reconciliation and rearrangement to "cancel out". Is this useful?
>
> Would you say this virtual stack stuff was complicated to implement? I
> know of several compilers that do it, but I haven't examined them. I
> think the approach could be useful for something I've gotten interested
> in, but I don't know what I'd be getting into if I attempted it. Thanks.

The compiler is about 1500 lines of code 50k bytes so it is not big. I think the
biggest problem is that you need a good integration with an assembler to
generate the final code. in lxf I use a stripped down version that covers the
opcodes I need. in lxf64 I generate intel asm source and send it to an external
assembler dll that returns the compiled blob. Other than that duped stack items
require some consideration. I also gave up on using pop and push instructions
to reconcile the returns stack, I could never get that to work. It was better using
mov instruction and one final adjustment of the stackpointer (esp).
I think Forth is an ideal language to write this in as you can start with a few words
using the code generator and then test and continue with others

BR
Peter

Re: Not really locals

<2021Sep12.105636@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sun, 12 Sep 2021 08:56:36 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 34
Message-ID: <2021Sep12.105636@mips.complang.tuwien.ac.at>
References: <shapgj$1a32$1@gioia.aioe.org> <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> <shibtq$16uo$1@gioia.aioe.org> <2021Sep11.215052@mips.complang.tuwien.ac.at> <871r5u936m.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="c44f096c1a6c40e22bb5d141b7a34564";
logging-data="20809"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2q6PYM7rJOG9fXYD5nu9x"
Cancel-Lock: sha1:5cQI8VY8sQJLNjgVl1abyhNfC4s=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 12 Sep 2021 08:56 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>>>> : 3dup.2 ( a b c -- a b c a b c ) 2 pick 2 pick 2 pick ;
>>>: 3DUP.4 DUP 2OVER ROT ;
>> Gforth-fast AMD64: ...
>
>Gforth-fast uses big and fast enough hardware that the cost of locals
>(if any) with it will almost always be negligible.

A, say, factor 1.5 slowdown is a factor 1.5 slowdown, whatever the
speed of the hardware. It only does not matter if the program is fast
enough in either case.

A more relevant point is that, if you care for performance, you use a
Forth like lxf, or VFX (and then ask Stephen Pelc when VFX will be
analytical about the return stack and locals:-); if you use Gforth or
dxforth, performance is not the most important thing, so why should
one base one's coding style on the performance on such systems?

>On a tiny bytecode
>implementation, 3dup.4 is very clever and impressive (probably just 3
>bytes).

If your compiler employs Matthias Koch's constant folding (which is
simple to implement), it can easily replace 2 PICK by THIRD, and then
it's also just 3 bytes in a byte-coded implementation. Even if you do
not employ constant folding, you can provide THIRD as separate word,
and get the same result.

- 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

<2021Sep12.114615@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sun, 12 Sep 2021 09:46:15 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 83
Message-ID: <2021Sep12.114615@mips.complang.tuwien.ac.at>
References: <shapgj$1a32$1@gioia.aioe.org> <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> <shibtq$16uo$1@gioia.aioe.org> <2021Sep11.215052@mips.complang.tuwien.ac.at> <2021Sep11.222320@mips.complang.tuwien.ac.at> <9460b63b-1e3a-40e9-ba7d-b9b6bcb22a1dn@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="c44f096c1a6c40e22bb5d141b7a34564";
logging-data="4078"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/D8GNeNSV1DDxXO8GUD3s2"
Cancel-Lock: sha1:6JSjIMd1QSXC+2pqHGoBMTKmViQ=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 12 Sep 2021 09:46 UTC

P Falth <peter.m.falth@gmail.com> writes:
>On Saturday, 11 September 2021 at 23:09:03 UTC+2, Anton Ertl wrote:
>> an...@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>> >And of course, lxf produces the same code for 3dup.4 as for all the
>> >other versions:
>> >
>> > 804FC1D 8B4500 mov eax , [ebp]
>> > 804FC20 8945F4 mov [ebp-Ch] , eax
>> > 804FC23 8B4504 mov eax , [ebp+4h]
>> > 804FC26 8945F8 mov [ebp-8h] , eax
>> > 804FC29 895DFC mov [ebp-4h] , ebx
>> > 804FC2C 8D6DF4 lea ebp , [ebp-Ch]
>> > 804FC2F C3 ret near
>> And the reason is that all four versions consist only of words that
>> lxf analyses at compile time, so all four versions result in zero
>> stuff to compile right away, and the same stack state to reconcile
>> with the calling convention, so the same code is generated (which
>> consists entirely of the reconciliation with the calling convention).
>
>Yes this is correct. But it does not analyse the code. Stack operations
>just move pointers on a virtual stack, no code is generated.

In the old days we had plain compilers with peephole optimization
(e.g., bigForth with peephole optimization on the machine-code level,
and SwiftForth which AFAIK combines primitives at the Forth level and
generates code for that), and anything beyond that has been called an
analytical compiler.

So if your compiler employs arbitrary stack representations by keeping
track at compile time what stack item resides in what register or what
memory location, that's an analytical compiler, and keeping track of
the stack items is analysis.

Gforth-fast supports few stack representations determined at Gforth
build time, but only represents them as finite states at compile time
and cannot keep track of arbitrary stack representations (e.g.,
already DUP requires at least copying from one register (or memory
location) to a different register), so I would not classify it as
analytical.

>In the example of the rectangle where lxf generated less good code
>this happened. The code could be written in this way to improve
>: preprect {: x1 y1 x2 y2 :} x1 y1 x1 y2 x2 y2 x2 y1 x1 y1 ; ok
>: rect4 preprect moveto lineto lineto lineto lineto ;
>
>the preprect will generate 43 bytes of stack shuffling and rect4
>30 bytes of calls ( 5 calls and one tail jump).

But when I inline PREPRECT manually, the PREPRECT code becomes quite a
bit longer, and I see some stores to the return stack. Strange.

>doing the same for the stack shuffling variant saves even more
>: rect5 2over 2>r 2>r over r@ 2r> over r@ 2r>
>moveto lineto lineto lineto lineto ;
>
>This will generate 67 bytes, saving one call and one ret.
>
>Of course this is a stupid way of actually writing it. But if you want to
>see what can be achived you will do it.

It's only stupid is your goal is to write code that is easy to
understand. If your goal is to produce the shortest code on lxf, it
is smart:-).

Let's try to make a smart version for VFX:

: rect7 ( x1 y1 x2 y2 -- )
3 pick 3 pick over 3 pick 5 pick 2dup 5 pick 5 pick over
moveto lineto lineto lineto lineto ;

( 88 bytes, 25 instructions )

Hmm; it tends not to keep the items that it has already loaded in
registers, and therefore has to reload them. lxf does a little better
at 82 bytes. Admittedly, this is the kind of code that nobody writes,
so it's understandable if VFX and lxf are not optimized for that.

- 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

<2021Sep12.123956@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sun, 12 Sep 2021 10:39:56 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 45
Message-ID: <2021Sep12.123956@mips.complang.tuwien.ac.at>
References: <shapgj$1a32$1@gioia.aioe.org> <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> <2021Sep11.083507@mips.complang.tuwien.ac.at> <3255ae60-2ba6-43b3-b1e6-7edf7031a4e6n@googlegroups.com>
Injection-Info: reader02.eternal-september.org; posting-host="c44f096c1a6c40e22bb5d141b7a34564";
logging-data="4078"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/tcBFtevx5oShHrlVLxpW8"
Cancel-Lock: sha1:37Swt0paulnEtFgXwac8h2EJadM=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 12 Sep 2021 10:39 UTC

Hans Bezemer <the.beez.speaks@gmail.com> writes:
>On Saturday, September 11, 2021 at 8:54:06 AM UTC+2, Anton Ertl wrote:
>> I find it funny that those who disapprove of some Forth features do=20
>> not give any concrete reasons for that. Instead, they use evocative=20
>> language, and point people to books, without pointing out any specific=20
>> place the should read. There are not many clearer ways to indicate=20
>> their lack of arguments.
....
>Philosophy goes deep. It's not something that fits half a page - as the peo=
>ple who do know most certainly do.

Tough luck. If you cannot explain the concrete benefits of your
philosophy on a concrete example, the rest of the world cannot
distinguish it from mumbo-jumbo.

>However, those who have a notion of desi=
>gn know that software unrevels and decays in two particular instances:
>a) Maintenance on software without an explicit design and architecture;
>b) Maintenance on software which does not respect an explicit design and ar=
>chitecture.
>
>Moore has always been very vocal on what this design and philosophy was.

It seems to me that Chuck Moore prefers rewriting over maintaining the
software, if new requirements come along. So it's strange that you
mention him in connection with maintenance.

>An=
>d it has been very well expressed in Thinking Forth and the fire chats. Vio=
>lating it almost killed Forth in 1983.

Really. What happened in 1983?

The fact that the Forth-83 standard (which appeared in 1984) made
changes that were incompatible with Forth-79 certainly caused a lot of
damage, but I see no relation to Thinking Forth and Chuck Moore; AFAIK
he has never spoken out against incompatible changes, and introduced a
number of them himself.

- 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

<shknb5$15fl$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!news.swapon.de!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: Sun, 12 Sep 2021 21:12:36 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shknb5$15fl$1@gioia.aioe.org>
References: <shapgj$1a32$1@gioia.aioe.org>
<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> <shibtq$16uo$1@gioia.aioe.org>
<2021Sep11.215052@mips.complang.tuwien.ac.at> <871r5u936m.fsf@nightsong.com>
<2021Sep12.105636@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="38389"; 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 - Sun, 12 Sep 2021 11:12 UTC

On 12/09/2021 18:56, Anton Ertl wrote:
> Paul Rubin <no.email@nospam.invalid> writes:
>>>>> : 3dup.2 ( a b c -- a b c a b c ) 2 pick 2 pick 2 pick ;
>>>>: 3DUP.4 DUP 2OVER ROT ;
>>> Gforth-fast AMD64: ...
>>
>>Gforth-fast uses big and fast enough hardware that the cost of locals
>>(if any) with it will almost always be negligible.
>
> A, say, factor 1.5 slowdown is a factor 1.5 slowdown, whatever the
> speed of the hardware. It only does not matter if the program is fast
> enough in either case.
>
> A more relevant point is that, if you care for performance, you use a
> Forth like lxf, or VFX (and then ask Stephen Pelc when VFX will be
> analytical about the return stack and locals:-); if you use Gforth or
> dxforth, performance is not the most important thing, so why should
> one base one's coding style on the performance on such systems?

If good coding produces good results on any system then surely it is
coding worth learning. If getting good results from locals means
using a specific forth compiler, then one is tied to that system (for
as long or short a time as the author cares to support it).

To my knowledge there is no VFX/LXF/GForth for CP/M systems. OTOH
there does appear to be many RC2014 Z80 systems and a surprising
degree of interest in forth. Their users weren't lured by locals.
They came for the full-on Forth experience.

Re: Not really locals

<2021Sep12.125356@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sun, 12 Sep 2021 10:53:56 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 103
Message-ID: <2021Sep12.125356@mips.complang.tuwien.ac.at>
References: <shapgj$1a32$1@gioia.aioe.org> <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> <shibtq$16uo$1@gioia.aioe.org> <2021Sep11.215052@mips.complang.tuwien.ac.at> <shjm2q$1hj8$1@gioia.aioe.org>
Injection-Info: reader02.eternal-september.org; posting-host="c44f096c1a6c40e22bb5d141b7a34564";
logging-data="22941"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1WWg8loElWRdwlAceWPgl"
Cancel-Lock: sha1:fk47TinQppGBwEfY9Eutk+bomHw=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 12 Sep 2021 10:53 UTC

dxforth <dxforth@gmail.com> writes:
>On 12/09/2021 05:50, Anton Ertl wrote:
>> dxforth <dxforth@gmail.com> writes:
>>>On 11/09/2021 15:37, Paul Rubin wrote:
>>>> : 3dup.2 ( a b c -- a b c a b c ) 2 pick 2 pick 2 pick ;
>>>: 3DUP.4 DUP 2OVER ROT ;
>>
>> Gforth-fast AMD64:
>>
>> see-code 3dup.2 see-code 3dup.4
>> $7FE5CCD711A8 third $7FE5CCD71278 dup
>> 7FE5CC966626: mov rax,$10[r13] 7FE5CC966714: sub r13,$08
>> 7FE5CC96662A: sub r13,$08 7FE5CC966718: add r14,$08
>> 7FE5CC96662E: add r14,$08 7FE5CC96671C: mov $08[r13],r15
>> 7FE5CC966632: mov $08[r13],r15 $7FE5CCD71280 2over
>> 7FE5CC966636: mov r15,rax 7FE5CC966720: mov rax,$10[r13]
>> $7FE5CCD711B0 third 7FE5CC966724: mov rdx,$18[r13]
>> 7FE5CC966639: mov rax,$10[r13] 7FE5CC966728: sub r13,$10
>> 7FE5CC96663D: sub r13,$08 7FE5CC96672C: add r14,$08
>> 7FE5CC966641: add r14,$08 7FE5CC966730: mov $10[r13],r15
>> 7FE5CC966645: mov $08[r13],r15 7FE5CC966734: mov $08[r13],rdx
>> 7FE5CC966649: mov r15,rax 7FE5CC966738: mov r15,rax
>> $7FE5CCD711B8 third $7FE5CCD71288 rot
>> 7FE5CC96664C: mov rax,$10[r13] 7FE5CC96673B: mov rax,$10[r13]
>> 7FE5CC966650: sub r13,$08 7FE5CC96673F: mov rdx,$08[r13]
>> 7FE5CC966654: add r14,$08 7FE5CC966743: add r14,$08
>> 7FE5CC966658: mov $08[r13],r15 7FE5CC966747: mov $08[r13],r15
>> 7FE5CC96665C: mov r15,rax 7FE5CC96674B: mov $10[r13],rdx
>> $7FE5CCD711C0 ;s ok 7FE5CC96674F: mov r15,rax
>> $7FE5CCD71290 ;s ok
>
>Few non-optimizing compilers define THIRD presumably as they had PICK
>and '2 PICK' doesn't arise that often.

In the present case the constant folding built into Gforth replaced 2
PICK with THIRD.

Concerning how often it occurs, here are some numbers from the
Gforth-AMD64 image:

953 dup
275 over
35 third
4 fourth
19 pick (5 pick, 4 pick, and non-constant pick)

For comparison:
335 swap
184 rot
4 roll (all non-constant, all on the same line)

223 2dup
21 2over

35 2swap
1 2rot

482 drop
206 2drop
111 nip
4 2nip

65 tuck
1 2tuck

374 >r
373 r>
157 r@
84 rdrop
48 2>r
45 2r>
13 2r@
11 2rdrop

>> VFX produces worse code for 3dup.1 because it is not analytical about
>> the return stack [...] Likewise [...] locals.
>
>I actually agree with that.

What is there to agree with? It' a statement of fact.

>A forth programmer expects to get what he
>writes - 'close to the metal' and all that. If one has no control over
>output one may as well use C.

I guess that you prefer a compiler that always generates the same
piece of code for a certain word (e.g., machineForth; wait, doesn't
machine code perform tail-call optimization?) to a compiler that
generates faster code in most cases (e.g., VFX, lxf and iForth).

OTOH, I prefer the faster code, and I especially like it if I don't
have to cater to the lack of capability of the compiler by writing
clever stack manipulation code.

I think that VFX has a flag for turning off optimization, which may be
the thing you want (I have not tried it, though).

- 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

static type checking (was: Not really locals)

<2021Sep12.131651@mips.complang.tuwien.ac.at>

  copy mid

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

  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: static type checking (was: Not really locals)
Date: Sun, 12 Sep 2021 11:16:51 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 29
Message-ID: <2021Sep12.131651@mips.complang.tuwien.ac.at>
References: <shapgj$1a32$1@gioia.aioe.org> <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> <2021Sep11.083507@mips.complang.tuwien.ac.at> <3255ae60-2ba6-43b3-b1e6-7edf7031a4e6n@googlegroups.com> <87o88y7duy.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="c44f096c1a6c40e22bb5d141b7a34564";
logging-data="22941"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX194LHopWdU/pi9PY0uA7Jco"
Cancel-Lock: sha1:17ZaRSVkqnluMTLDxqBtglXyk5Q=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 12 Sep 2021 11:16 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>Hans Bezemer <the.beez.speaks@gmail.com> writes:
>> Most of the time however, reality wins. Or do you think it's a smart
>> move to do ducktyping by design and then add all kinds of type
>> checking functionality all of a sudden? Especially when you always
>> stated "there is alaways one obvious way to do it"? Does that
>> consitute a clear vision?
>
>Are you talking about MyPy? I use it and I think it does some good,
>though you are right that it is imperfect as an add-on. There are
>similar things for Erlang (the Dialyzer), typed Clojure, typed Racket,
>and a general topic called "gradual typing" for such things. In each
>case, they seem to help. It seems to me that latent/duck typing works
>best for relatively small programs, and static types become worth their
>weight in larger programs.

Maybe in large monolithic programs. OTOH, it seems to me that static
type checking is a hindrance for a network of independently developed
packages. There are package repositories like CPAN and PyPI for
dynamic languages, but efforts like this for static languages have not
been similarly successful; e.g., in the case of Java, CJAN ceased
development in 2004 and Apache JJAR is essentially abandoned.

- 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

<2021Sep12.132752@mips.complang.tuwien.ac.at>

  copy mid

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

  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: Sun, 12 Sep 2021 11:27:52 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 51
Message-ID: <2021Sep12.132752@mips.complang.tuwien.ac.at>
References: <shapgj$1a32$1@gioia.aioe.org> <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> <shibtq$16uo$1@gioia.aioe.org> <2021Sep11.215052@mips.complang.tuwien.ac.at> <2021Sep11.222320@mips.complang.tuwien.ac.at> <9460b63b-1e3a-40e9-ba7d-b9b6bcb22a1dn@googlegroups.com> <87k0jm6zou.fsf@nightsong.com>
Injection-Info: reader02.eternal-september.org; posting-host="c44f096c1a6c40e22bb5d141b7a34564";
logging-data="22941"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Cw+cnmOl2gHfcdBI/1RGK"
Cancel-Lock: sha1:a6Ae6T9OQxOqFLYW5WIXUlDfazE=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Sun, 12 Sep 2021 11:27 UTC

Paul Rubin <no.email@nospam.invalid> writes:
>Do you compile every word separately, i.e. starting with with no
>knowledge of the stack state other than from the word definition? If
>you have to reconcile the stack at the end, do you just put it into the
>state that a normal Forth interpreter would leave it in, or do you
>possibly make adjustments depending on the definitions of other words?

lxf and VFX only analyze basic blocks (VFX after inlining; lxf does
not inline). iForth seems to analyze the whole definition.

>If you compile FOO and that has some reconciliation at the end, and
>later BAR uses FOO's output but might have been better off starting from
>an intermediate state of FOO, then maybe the inlined FOO BAR would allow
>some reconciliation and rearrangement to "cancel out". Is this useful?

Inlining is generally performed by replaying a name-resolved version
of the source code of the inlined word to the compiler (it also has to
deal with EXIT), and that means that if you have

: foo dup ;
: bar foo drop ;

the inlining compiler will see

: bar dup drop ;

and on VFX this results in:

BAR
( 080C0AB0 C3 ) NEXT,
( 1 bytes, 1 instructions )

>Would you say this virtual stack stuff was complicated to implement? I
>know of several compilers that do it, but I haven't examined them.

IIRC Stephen Pelc wrote that what I called reconciling recently is
very complicated. I think you can make it less complicated by
modeling it as first moving everything to a temporary location, and
then moving everything to the target location, eliminating moves if
liveness permits, and finally emitting the remaining moves. There are
more optimal ways, and I can look them up if you want, but they are
not simpler.

The rest is relatively straightforward.

- 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

<shkppp$8n1$1@gioia.aioe.org>

  copy mid

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

  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: Sun, 12 Sep 2021 21:54:32 +1000
Organization: Aioe.org NNTP Server
Message-ID: <shkppp$8n1$1@gioia.aioe.org>
References: <shapgj$1a32$1@gioia.aioe.org>
<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> <shibtq$16uo$1@gioia.aioe.org>
<2021Sep11.215052@mips.complang.tuwien.ac.at> <shjm2q$1hj8$1@gioia.aioe.org>
<2021Sep12.125356@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="8929"; 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 - Sun, 12 Sep 2021 11:54 UTC

On 12/09/2021 20:53, Anton Ertl wrote:
>
> I guess that you prefer a compiler that always generates the same
> piece of code for a certain word (e.g., machineForth; wait, doesn't
> machine code perform tail-call optimization?) to a compiler that
> generates faster code in most cases (e.g., VFX, lxf and iForth).
> ...
> I think that VFX has a flag for turning off optimization, which may be
> the thing you want (I have not tried it, though).

I've no idea what machineForth does but if it inlines code such that
it breaks a working program (as VFX did) then it's a bug I don't wish
to waste my time running down.

Re: Not really locals

<2432199f-8d36-44bc-b462-0b818e2a3d9bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:14b1:: with SMTP id x17mr6485208qkj.37.1631463908254;
Sun, 12 Sep 2021 09:25:08 -0700 (PDT)
X-Received: by 2002:a37:2dc7:: with SMTP id t190mr6328045qkh.60.1631463908068;
Sun, 12 Sep 2021 09:25:08 -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: Sun, 12 Sep 2021 09:25:07 -0700 (PDT)
In-Reply-To: <2021Sep12.123956@mips.complang.tuwien.ac.at>
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> <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>
<2021Sep11.083507@mips.complang.tuwien.ac.at> <3255ae60-2ba6-43b3-b1e6-7edf7031a4e6n@googlegroups.com>
<2021Sep12.123956@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2432199f-8d36-44bc-b462-0b818e2a3d9bn@googlegroups.com>
Subject: Re: Not really locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Sun, 12 Sep 2021 16:25:08 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 34
 by: Hans Bezemer - Sun, 12 Sep 2021 16:25 UTC

On Sunday, September 12, 2021 at 12:53:13 PM UTC+2, Anton Ertl wrote:
> Tough luck. If you cannot explain the concrete benefits of your
> philosophy on a concrete example, the rest of the world cannot
> distinguish it from mumbo-jumbo.
For "flat earthers" calculations are also mumbo-jumbo. The reason: they can't be bothered by diving into the stuff and do the work. Hence, they write it off as "mumbo-jumbo".
It isn't restricted to "flat earthers", though. Other people - who are far over their head on a specific subject and don't want to do the work - use the term as well. It's closely connected to Dunning-Kruger effect.

> It seems to me that Chuck Moore prefers rewriting over maintaining the
> software, if new requirements come along. So it's strange that you
> mention him in connection with maintenance.
You can't be serous when you try to compare the maintenance of applications written IN a language with the maintenance of the language ITSELF.
> The fact that the Forth-83 standard (which appeared in 1984) made
> changes that were incompatible with Forth-79 certainly caused a lot of
> damage, but I see no relation to Thinking Forth and Chuck Moore; AFAIK
> he has never spoken out against incompatible changes, and introduced a
> number of them himself.
Forth was quite popular in the early 80-ies. However, "pragmatic" changes not only broke a lot of code - they made Forth into an ugly mess. E.g. eliminating "smart" words, setting cellsize to 2 bytes (sic!) and destroying DO...LOOP beyond repair. I didn't like it - and obviously a lot of people with me, since its use fell dramatically. And it still hasn't recovered. Good going.

That you CAN do it, doesn't mean you SHOULD do it. There is a subtle, but relevant difference between the two. You can add wings to a car, but there's a chance it not only flies worse than a plane, but also performs worse as a car.

Hans Bezemer

Re: Not really locals

<9df6a9f7-06e2-4454-adce-732a46e7a845n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:1671:: with SMTP id d17mr6897528qko.191.1631467403983;
Sun, 12 Sep 2021 10:23:23 -0700 (PDT)
X-Received: by 2002:a05:620a:4cf:: with SMTP id 15mr6559066qks.316.1631467403822;
Sun, 12 Sep 2021 10:23:23 -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: Sun, 12 Sep 2021 10:23:23 -0700 (PDT)
In-Reply-To: <87o88y7duy.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:8ec:6c90:d6e1:ee76;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:8ec:6c90:d6e1:ee76
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> <2021Sep11.083507@mips.complang.tuwien.ac.at>
<3255ae60-2ba6-43b3-b1e6-7edf7031a4e6n@googlegroups.com> <87o88y7duy.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9df6a9f7-06e2-4454-adce-732a46e7a845n@googlegroups.com>
Subject: Re: Not really locals
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Sun, 12 Sep 2021 17:23:23 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 24
 by: S Jack - Sun, 12 Sep 2021 17:23 UTC

On Saturday, September 11, 2021 at 8:59:51 PM UTC-5, Paul Rubin wrote:
> Forth is fairly dead right now. Maybe the unneeded stack juggling is
> a contributing factor.

<saga> Lets make Forth great again!
In industry a manager stands in quicksand with alligators biting at
his butt, his arms tightly bound by a boa going for his neck,
and his head in a cloud of mosquitoes and hornets. Along the dry bank
comes whistling and skipping a little programmer. He sees the
manager and shouts "Hey Boss, I got just the thing to fix all your
problems. It's called FORTH!". Something boils up in the manager and
he's able to free one arm from the boa. He grabs the programmer and
throws him down to the gators. With the gators distracted in their
feeding the manager plods his way to the far bank and with his one
free hand takes the boa's head banging it against a tree till its dead.
Taking a head net from his pocket he pulls it over his head for
some relief from the swarming pests and sits down leaning against
the tree. He doesn't sit long. After a few deep breaths, he somehow
bolsters himself up to continue his trek through the jungle knowing
that his next step is likely to land him in the same predicament once
again. Strangely, the thought of the programmer and the word Forth
never enters his consciousness.
</saga>
--
me

Re: Not really locals

<613e3a25$0$702$14726298@news.sunsite.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Subject: Re: Not really locals
Newsgroups: comp.lang.forth
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> <2021Sep11.083507@mips.complang.tuwien.ac.at>
<3255ae60-2ba6-43b3-b1e6-7edf7031a4e6n@googlegroups.com>
<87o88y7duy.fsf@nightsong.com>
<9df6a9f7-06e2-4454-adce-732a46e7a845n@googlegroups.com>
From: dhoffman...@gmail.com (Doug Hoffman)
Date: Sun, 12 Sep 2021 13:34:26 -0400
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.14.0
MIME-Version: 1.0
In-Reply-To: <9df6a9f7-06e2-4454-adce-732a46e7a845n@googlegroups.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Lines: 34
Message-ID: <613e3a25$0$702$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 90a8a131.news.sunsite.dk
X-Trace: 1631468069 news.sunsite.dk 702 glidedog@gmail.com/68.55.82.126:52889
X-Complaints-To: staff@sunsite.dk
 by: Doug Hoffman - Sun, 12 Sep 2021 17:34 UTC

On 9/12/21 1:23 PM, S Jack wrote:
> On Saturday, September 11, 2021 at 8:59:51 PM UTC-5, Paul Rubin wrote:
>> Forth is fairly dead right now. Maybe the unneeded stack juggling is
>> a contributing factor.
>
> <saga> Lets make Forth great again!
> In industry a manager stands in quicksand with alligators biting at
> his butt, his arms tightly bound by a boa going for his neck,
> and his head in a cloud of mosquitoes and hornets. Along the dry bank
> comes whistling and skipping a little programmer. He sees the
> manager and shouts "Hey Boss, I got just the thing to fix all your
> problems. It's called FORTH!". Something boils up in the manager and
> he's able to free one arm from the boa. He grabs the programmer and
> throws him down to the gators. With the gators distracted in their
> feeding the manager plods his way to the far bank and with his one
> free hand takes the boa's head banging it against a tree till its dead.
> Taking a head net from his pocket he pulls it over his head for
> some relief from the swarming pests and sits down leaning against
> the tree. He doesn't sit long. After a few deep breaths, he somehow
> bolsters himself up to continue his trek through the jungle knowing
> that his next step is likely to land him in the same predicament once
> again. Strangely, the thought of the programmer and the word Forth
> never enters his consciousness.

Good story about the realities of working in a time and cost competitive
environment.

When the rubber hits the road I would shamelessly use locals in a few
words if that got the job done for the customer deadline and measurement
showed that the code size and execution time were non-issues.

Maybe later clean it up, if time permitted. Maybe.

-Doug


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

Pages:1234567
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor