Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Netscape is not a newsreader, and probably never shall be. -- Tom Christiansen


devel / comp.lang.forth / Re: Another example of factoring and locals

SubjectAuthor
* Another example of factoring and localsAnton Ertl
`* Re: Another example of factoring and localsdxforth
 `* Re: Another example of factoring and localsAnton Ertl
  `* Re: Another example of factoring and localsdxforth
   `* Re: Another example of factoring and localsHans Bezemer
    `* Re: Another example of factoring and localsAnton Ertl
     `* Re: Another example of factoring and localsdxforth
      +* Re: Another example of factoring and localsPaul Rubin
      |+* Re: Another example of factoring and localsminf...@arcor.de
      ||+* Re: Another example of factoring and localsHans Bezemer
      |||+* Re: Another example of factoring and localsPaul Rubin
      ||||`* Re: Another example of factoring and localsdxforth
      |||| `* Re: Another example of factoring and localsPaul Rubin
      ||||  `* Re: Another example of factoring and localsdxforth
      ||||   `* Re: Another example of factoring and localsPaul Rubin
      ||||    +* Re: Another example of factoring and localsdxforth
      ||||    |+* Re: Another example of factoring and localsMarcel Hendrix
      ||||    ||`* Re: Another example of factoring and localsPaul Rubin
      ||||    || `* Re: Another example of factoring and localsdxforth
      ||||    ||  `- Re: Another example of factoring and localsMarcel Hendrix
      ||||    |+* Re: Another example of factoring and localsS Jack
      ||||    ||`- Re: Another example of factoring and localsdxforth
      ||||    |`* Re: Another example of factoring and localsPaul Rubin
      ||||    | +* Re: Another example of factoring and localsdxforth
      ||||    | |+* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||+* Re: Another example of factoring and localsDoug Hoffman
      ||||    | |||+* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||+- Re: Another example of factoring and localsnone
      ||||    | ||||`* Re: Another example of factoring and localsDoug Hoffman
      ||||    | |||| +- Re: Another example of factoring and localsminf...@arcor.de
      ||||    | |||| +- Re: Another example of factoring and localsdxforth
      ||||    | |||| `* Re: Another example of factoring and localsdxforth
      ||||    | ||||  `* Re: Another example of factoring and localsDoug Hoffman
      ||||    | ||||   `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    +- Re: Another example of factoring and localsHans Bezemer
      ||||    | ||||    +- Re: Another example of factoring and localsBrian Fox
      ||||    | ||||    +* Re: Another example of factoring and localsDoug Hoffman
      ||||    | ||||    |`* Re: Another example of factoring and localsdxforth
      ||||    | ||||    | `* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |  `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |   `* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |    `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |     `* Re: Another example of factoring and localsMarcel Hendrix
      ||||    | ||||    |      `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |       `* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |        `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |         `* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |          `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |           +* Re: Another example of factoring and localsMarcel Hendrix
      ||||    | ||||    |           |+- Re: Another example of factoring and localsdxforth
      ||||    | ||||    |           |`- Re: Another example of factoring and localsdxforth
      ||||    | ||||    |           `* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |            +* Re: Another example of factoring and localsminf...@arcor.de
      ||||    | ||||    |            |`* Re: Another example of factoring and localsMarcel Hendrix
      ||||    | ||||    |            | +- Re: Another example of factoring and localsminf...@arcor.de
      ||||    | ||||    |            | +- Re: Another example of factoring and localsminf...@arcor.de
      ||||    | ||||    |            | `* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |  +* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |            |  |+* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |  ||`* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |            |  || `- Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |  |`* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |  | +- Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |  | `* Re: Another example of factoring and localsHans Bezemer
      ||||    | ||||    |            |  |  `* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |  |   `* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |            |  |    `- Re: Another example of factoring and localsdave thompson 2
      ||||    | ||||    |            |  `* Re: Another example of factoring and localsMarcel Hendrix
      ||||    | ||||    |            |   `* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |    `* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |            |     +- Re: Another example of factoring and localsnone
      ||||    | ||||    |            |     `- Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            +* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |+- Re: Another example of factoring and localsnone
      ||||    | ||||    |            |`- Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            +- Re: Another example of factoring and localsnone
      ||||    | ||||    |            +* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |+- Re: Another example of factoring and localsminf...@arcor.de
      ||||    | ||||    |            |`* Re: Another example of factoring and localsHans Bezemer
      ||||    | ||||    |            | `* Re: Another example of factoring and localsminf...@arcor.de
      ||||    | ||||    |            |  +* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |  |`* Re: Another example of factoring and localsminf...@arcor.de
      ||||    | ||||    |            |  | +* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |            |  | |+- Re: Another example of factoring and localsminf...@arcor.de
      ||||    | ||||    |            |  | |`- Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |  | `* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |  |  `- Re: Another example of factoring and localsminf...@arcor.de
      ||||    | ||||    |            |  `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |   `* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |    `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |     `* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |      +* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |      |`* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |      | `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |      |  +* Re: Another example of factoring and localsMarcel Hendrix
      ||||    | ||||    |            |      |  |`- Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |      |  +* Re: Another example of factoring and localsAnton Ertl
      ||||    | ||||    |            |      |  |`* Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |      |  | `* Re: Another example of factoring and localsnone
      ||||    | ||||    |            |      |  |  `- Re: Another example of factoring and localsdxforth
      ||||    | ||||    |            |      |  `* Re: Another example of factoring and localsPaul Rubin
      ||||    | ||||    |            |      `* Re: Another example of factoring and localsnone
      ||||    | ||||    |            +* Re: Another example of factoring and localsLars Brinkhoff
      ||||    | ||||    |            `* Re: Another example of factoring and localsdxforth
      ||||    | ||||    +- Re: Another example of factoring and localsHans Bezemer
      ||||    | ||||    +* Re: Another example of factoring and localsMarcel Hendrix
      ||||    | ||||    +- Re: Another example of factoring and localsHans Bezemer
      ||||    | ||||    +- Re: Another example of factoring and localsP Falth
      ||||    | ||||    `- Re: Another example of factoring and localsminf...@arcor.de
      ||||    | |||`* Re: Another example of factoring and localsHans Bezemer
      ||||    | ||+- Re: Another example of factoring and localsdxforth
      ||||    | ||`* Re: Another example of factoring and localsHans Bezemer
      ||||    | |`- Re: Another example of factoring and localsnone
      ||||    | +- Re: Another example of factoring and localsStephen Pelc
      ||||    | `* Re: Another example of factoring and localsantispam
      ||||    +- Re: Another example of factoring and localsHans Bezemer
      ||||    `- Re: Another example of factoring and localsHans Bezemer
      |||`* Re: Another example of factoring and localsGerry Jackson
      ||`* Re: Another example of factoring and localsPaul Rubin
      |+- Re: Another example of factoring and localsHans Bezemer
      |`* Re: Another example of factoring and localsdxforth
      `* Re: Another example of factoring and localsHans Bezemer

Pages:123456789
Re: Another example of factoring and locals

<87v8o25nhu.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Sat, 29 Oct 2022 14:27:41 -0700
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <87v8o25nhu.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="24cfaae33053435b18522897d37aeed4";
logging-data="3884942"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Nyx8Q9TEts6GoNrf5cHa+"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:DU6a/7Od9AV3v+WHbNeuLnM38ZM=
sha1:a1kJ0Nd74frwmx8W5W8ogUHX5Hw=
 by: Paul Rubin - Sat, 29 Oct 2022 21:27 UTC

dxforth <dxforth@gmail.com> writes:
> How many times will you code Z* ? FWIW FSLIB already has it.

Z* is a simple example. The issue comes up with some regularity.

> FP locals isn't supported by any standard.

Hmm, I didn't realize that, I mostly use gforth. It is unfortunate.

> Some folks have suggested there should be a F>R R>F which would allow
> recursive f/p variables.

That could help, but might as well support FP locals directly.

> IIRC Wil Baden had a scheme that used memory at HERE as f/p locals.

That sounds pretty messy. Was it hooked into (LOCAL) somehow? What
happens if your function ALLOTs something after making the locals? Does
the space for the locals not get reclaimed?

> The situations you present as requiring locals are obscure enough that
> there is almost always another way. But you have to want to find it.

The examples I gave were real. I don't claim anything "requires" locals
in the sense that finding another way is impossible. But finding and
implementing another way obviously imposes costs, and I don't currently
see an offsetting benefit. Before wanting to find the other way, I'd
first want to know what I'd gain from finding it. If I have a method
that works, why search for ways to make more pain for myself instead
of just getting on with it?

> In Forth, locals are all about style... Unfortunately Forth was never
> designed for it. Compared to data stack, the return stack is the
> smaller - intended only to hold return addresses and the occasional
> temp. Nested definitions using locals will quickly eat it up.

The return stack being smaller depends on the implementation ofc. Some
implementations (gforth) use a separate locals stack. An optimizing
compiler can in some cases put the locals in registers which is cheaper
than putting them on any stack. They can also be in the heap, which
unlike even the data stack, can have non-contiguous locals areas without
much hassle.

Admittedly I've been using gforth on machines with gigabytes of memory
but I don't see a big issue even on small MCU's. Of course you have to
maintain some awareness of stack usage from locals, but you have to
maintain that awareness for everything else too.

Re: Another example of factoring and locals

<tjklqe$g5m$1@gioia.aioe.org>

  copy mid

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

  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: Another example of factoring and locals
Date: Sun, 30 Oct 2022 12:59:43 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tjklqe$g5m$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.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="16566"; 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:102.0) Gecko/20100101
Thunderbird/102.4.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sun, 30 Oct 2022 01:59 UTC

On 30/10/2022 8:27 am, Paul Rubin wrote:
> dxforth <dxforth@gmail.com> writes:
>> How many times will you code Z* ? FWIW FSLIB already has it.
>
> Z* is a simple example. The issue comes up with some regularity.
>
>> FP locals isn't supported by any standard.
>
> Hmm, I didn't realize that, I mostly use gforth. It is unfortunate.

Unfortunate has been the mixed messaging. Moore couldn't be more explicit
locals had no place in Forth. Still, better one can find that out for
oneself. Locals in Forth can be likened to chocolate. Irresistible to
the sweet-toothed.

Re: Another example of factoring and locals

<87r0yp6fdk.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Sat, 29 Oct 2022 22:37:43 -0700
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <87r0yp6fdk.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="cea46089826d7fc87e6e49b2f07919cc";
logging-data="4189824"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/iKte+qUilmkQw2JCu9ody"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:Xz0T2DhMPpOEPyupvM8IWGbt5WE=
sha1:kZUxE/MTjKnyZ38pS3WJySHifcs=
 by: Paul Rubin - Sun, 30 Oct 2022 05:37 UTC

dxforth <dxforth@gmail.com> writes:
> Unfortunate has been the mixed messaging. Moore couldn't be more explicit
> locals had no place in Forth.

Moore, I've heard of that guy. Isn't he the one who invented PICK and
ROLL because his Forth didn't have locals? Once you've turned the stack
into an indexible array, you might as well be able to give names to the
slots.

Re: Another example of factoring and locals

<tjl4rl$fmb$1@gioia.aioe.org>

  copy mid

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

  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: Another example of factoring and locals
Date: Sun, 30 Oct 2022 17:16:21 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tjl4rl$fmb$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.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="16075"; 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:102.0) Gecko/20100101
Thunderbird/102.4.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sun, 30 Oct 2022 06:16 UTC

On 30/10/2022 4:37 pm, Paul Rubin wrote:
> dxforth <dxforth@gmail.com> writes:
>> Unfortunate has been the mixed messaging. Moore couldn't be more explicit
>> locals had no place in Forth.
>
> Moore, I've heard of that guy. Isn't he the one who invented PICK and
> ROLL because his Forth didn't have locals? Once you've turned the stack
> into an indexible array, you might as well be able to give names to the
> slots.

It appears he found them superfluous:

"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."

"It is necessary to have variables."

http://www.ultratechnology.com/1xforth.htm

Re: Another example of factoring and locals

<9f56032a-e678-495f-9df5-c44803622796n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:24d5:b0:6ee:d4bb:e5ba with SMTP id m21-20020a05620a24d500b006eed4bbe5bamr5288924qkn.457.1667114749324;
Sun, 30 Oct 2022 00:25:49 -0700 (PDT)
X-Received: by 2002:a05:690c:802:b0:36b:adba:8ff with SMTP id
bx2-20020a05690c080200b0036badba08ffmr7061536ywb.237.1667114749001; Sun, 30
Oct 2022 00:25:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 30 Oct 2022 00:25:48 -0700 (PDT)
In-Reply-To: <tjl4rl$fmb$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:f4bf:25c5:5a51:4bed;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:f4bf:25c5:5a51:4bed
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at> <tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com> <2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com> <74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9f56032a-e678-495f-9df5-c44803622796n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Sun, 30 Oct 2022 07:25:49 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2368
 by: Marcel Hendrix - Sun, 30 Oct 2022 07:25 UTC

On Sunday, October 30, 2022 at 7:16:24 AM UTC+1, dxforth wrote:
[..]
> "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."
>
> "It is necessary to have variables."

That is simply describing what 'a machine' has available. The final statement
is a logical conclusion.

> http://www.ultratechnology.com/1xforth.htm

Somebody should restore these tapes. My hunch is that there will
be surprising nuance.

-marcel

Re: Another example of factoring and locals

<87mt9d69ip.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Sun, 30 Oct 2022 00:44:14 -0700
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <87mt9d69ip.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<9f56032a-e678-495f-9df5-c44803622796n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="cea46089826d7fc87e6e49b2f07919cc";
logging-data="54956"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19lgUz1kFWQhwN3BkLb9iwn"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:t8WNl186LyjlDosu5tlB2Q/5zfw=
sha1:tT4T3+DLPYGV8C58hVDQoP8YuXM=
 by: Paul Rubin - Sun, 30 Oct 2022 07:44 UTC

Marcel Hendrix <mhx@iae.nl> writes:
>> http://www.ultratechnology.com/1xforth.htm
> Somebody should restore these tapes. My hunch is that there will
> be surprising nuance.

I'm sure I watched that video on youtube years ago. It looks like it
has been re-uploaded more recently, by Gavino, a surprising and nice
contribution.

https://www.youtube.com/watch?v=pSnNy7IpVMg

Re: Another example of factoring and locals

<tjlfkt$3h4$1@gioia.aioe.org>

  copy mid

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

  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: Another example of factoring and locals
Date: Sun, 30 Oct 2022 20:20:30 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tjlfkt$3h4$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<9f56032a-e678-495f-9df5-c44803622796n@googlegroups.com>
<87mt9d69ip.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="3620"; 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:102.0) Gecko/20100101
Thunderbird/102.4.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sun, 30 Oct 2022 09:20 UTC

On 30/10/2022 6:44 pm, Paul Rubin wrote:
> Marcel Hendrix <mhx@iae.nl> writes:
>>> http://www.ultratechnology.com/1xforth.htm
>> Somebody should restore these tapes. My hunch is that there will
>> be surprising nuance.
>
> I'm sure I watched that video on youtube years ago. It looks like it
> has been re-uploaded more recently, by Gavino, a surprising and nice
> contribution.
>
> https://www.youtube.com/watch?v=pSnNy7IpVMg

No - the unexpurgated version ...

https://youtu.be/ZYlOV7K-xOU?t=49

Re: Another example of factoring and locals

<3df4c80b-3093-41c7-a8f7-134be94c66efn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:300e:b0:4bb:717e:72a with SMTP id ke14-20020a056214300e00b004bb717e072amr6435466qvb.15.1667126319589;
Sun, 30 Oct 2022 03:38:39 -0700 (PDT)
X-Received: by 2002:a0d:d74d:0:b0:36b:7256:9355 with SMTP id
z74-20020a0dd74d000000b0036b72569355mr7708959ywd.61.1667126319387; Sun, 30
Oct 2022 03:38:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 30 Oct 2022 03:38:39 -0700 (PDT)
In-Reply-To: <tjlfkt$3h4$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:f4bf:25c5:5a51:4bed;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:f4bf:25c5:5a51:4bed
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at> <tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com> <2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com> <74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<9f56032a-e678-495f-9df5-c44803622796n@googlegroups.com> <87mt9d69ip.fsf@nightsong.com>
<tjlfkt$3h4$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3df4c80b-3093-41c7-a8f7-134be94c66efn@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Sun, 30 Oct 2022 10:38:39 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2059
 by: Marcel Hendrix - Sun, 30 Oct 2022 10:38 UTC

On Sunday, October 30, 2022 at 10:20:33 AM UTC+1, dxforth wrote:
[..]
> https://youtu.be/ZYlOV7K-xOU?t=49

I admit it is dead-on with respect to the underlying sentiments
in this discussion :--)

-marcel

Re: Another example of factoring and locals

<4431a338-f82c-46b5-83d8-0009e5abc628n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5bcf:0:b0:3a4:f2a4:58b8 with SMTP id b15-20020ac85bcf000000b003a4f2a458b8mr6807563qtb.462.1667133869914;
Sun, 30 Oct 2022 05:44:29 -0700 (PDT)
X-Received: by 2002:a25:380d:0:b0:6c2:6c96:877a with SMTP id
f13-20020a25380d000000b006c26c96877amr8288894yba.530.1667133869561; Sun, 30
Oct 2022 05:44:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 30 Oct 2022 05:44:29 -0700 (PDT)
In-Reply-To: <87r0yp6fdk.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.174.47.232; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 77.174.47.232
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at> <tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com> <2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com> <74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org> <87r0yp6fdk.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4431a338-f82c-46b5-83d8-0009e5abc628n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Sun, 30 Oct 2022 12:44:29 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2559
 by: Hans Bezemer - Sun, 30 Oct 2022 12:44 UTC

On Sunday, October 30, 2022 at 6:37:46 AM UTC+1, Paul Rubin wrote:
> dxforth <dxf...@gmail.com> writes:
> Moore, I've heard of that guy. Isn't he the one who invented PICK and
> ROLL because his Forth didn't have locals? Once you've turned the stack
> into an indexible array, you might as well be able to give names to the
> slots.
Well, in his 1993 interview he was quoted to have said: "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". (http://www.ultratechnology.com/moore4th.htm)

It's also explicitly listed in "Thinking Forth" - although that one was not written
by Moore. It's just the penultimate work on Forth philosophy..

So it must have been another Moore, I guess.. There are so many Moores writing
Forth..

Hans Bezemer

Re: Another example of factoring and locals

<ce91d2ea-b341-4539-afee-6fb40bf63172n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:1a13:b0:6fa:88d:5239 with SMTP id bk19-20020a05620a1a1300b006fa088d5239mr5878449qkb.756.1667134594340;
Sun, 30 Oct 2022 05:56:34 -0700 (PDT)
X-Received: by 2002:a25:b851:0:b0:6ca:2b0b:d334 with SMTP id
b17-20020a25b851000000b006ca2b0bd334mr7910793ybm.104.1667134594044; Sun, 30
Oct 2022 05:56:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 30 Oct 2022 05:56:33 -0700 (PDT)
In-Reply-To: <tjl4rl$fmb$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:ad52:e762:d3d2:5fd8;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:ad52:e762:d3d2:5fd8
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at> <tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com> <2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com> <74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ce91d2ea-b341-4539-afee-6fb40bf63172n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Sun, 30 Oct 2022 12:56:34 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2101
 by: S Jack - Sun, 30 Oct 2022 12:56 UTC

On Sunday, October 30, 2022 at 1:16:24 AM UTC-5, dxforth wrote:
>
> http://www.ultratechnology.com/1xforth.htm

ColorForth and Moore's vision are intriguing; however, I'm out of time
for transforming into a "moti" and beginning new adventure. If I were
younger, I would eagerly start with ColorForth and begin some endeavor of
UXN like "Past proofing".
--
me

Re: Another example of factoring and locals

<7d5bde9b-405f-4bf3-8cb5-9337d84a9d8en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:2484:b0:4bb:de5d:b6e4 with SMTP id gi4-20020a056214248400b004bbde5db6e4mr3467615qvb.126.1667137035695;
Sun, 30 Oct 2022 06:37:15 -0700 (PDT)
X-Received: by 2002:a81:de43:0:b0:368:ee18:f9c3 with SMTP id
o3-20020a81de43000000b00368ee18f9c3mr8211336ywl.322.1667137035460; Sun, 30
Oct 2022 06:37:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 30 Oct 2022 06:37:15 -0700 (PDT)
In-Reply-To: <87r0yp6fdk.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.174.47.232; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 77.174.47.232
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at> <tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com> <2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com> <74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org> <87r0yp6fdk.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7d5bde9b-405f-4bf3-8cb5-9337d84a9d8en@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Sun, 30 Oct 2022 13:37:15 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2772
 by: Hans Bezemer - Sun, 30 Oct 2022 13:37 UTC

On Sunday, October 30, 2022 at 6:37:46 AM UTC+1, Paul Rubin wrote:
> Moore, I've heard of that guy. Isn't he the one who invented PICK and
> ROLL because his Forth didn't have locals? Once you've turned the stack
> into an indexible array, you might as well be able to give names to the
> slots.

BTW - PICK and ROLL do not make a stack into an indexable array. Even
when using dynamic memory (unless you reallocate it by a resize) I can
be pretty much assured that every time I get an indexed element, it points
to the very same memory address. However, if I do a "5 PICK", the next time
I do a "5 PICK" it will get me the contents of a very different address. If I
want the same element I have to issue "6 PICK".

ROLL - on the other hand - shifts the contents. You may get the same address,
but completely different content. The ontology of ROLL is more difficult, though
- I agree. It's more a question of semantics here.

So, PICK does NOT turn a stack into an "indexable array" - which makes the
next argument "being able to give names to the slots" completely untenable.

Hans Bezemer

Re: Another example of factoring and locals

<tjm3hp$6gt4$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Sun, 30 Oct 2022 15:00:09 +0000
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <tjm3hp$6gt4$1@dont-email.me>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<tjilf4$3d93q$1@dont-email.me>
<21bfb08d-2c13-40d1-a8fb-cdec1676667dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 30 Oct 2022 15:00:09 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="3c7339025101e5a74c921365f1dfc355";
logging-data="213924"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+97WgMXqfnxv3scc9ekrLp0pvpkFE279w="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.0
Cancel-Lock: sha1:13UyuCIBR0EPC/s96IMBtX4b3TU=
In-Reply-To: <21bfb08d-2c13-40d1-a8fb-cdec1676667dn@googlegroups.com>
 by: Gerry Jackson - Sun, 30 Oct 2022 15:00 UTC

On 29/10/2022 09:05, Marcel Hendrix wrote:
> On Saturday, October 29, 2022 at 9:41:27 AM UTC+2, Gerry Jackson wrote:
> [..]
>> Seems a bit of a dog's breakfast to me: unnecesssary use of a variable,
>> lengthy definition and unnecessary call to PLACE, crashes if i=0,
>> incorrect & misleading stack comment. Compare with:
>>
>> : concat ( ca1 u1 .. can un n ca -- ca+1 u )
>> 0 over c! swap
>> [: ?dup if 2swap 2>r 1- recurse dup 2r> rot +place then ;]
>> execute count
>> ;
>
> FORTH> : concats ( ca1 u1 .. can un n -- ca u ) 1- 0 max 0 ?DO $+ LOOP ;
> FORTH> S" Hello" S" , " S" world" S" !" 4 concats
> [2]FORTH> type Hello, world! ok
>

So your $+ prepends a string to another into some buffer. See DX alternative

--
Gerry

Re: Another example of factoring and locals

<tjm431$6gt4$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Sun, 30 Oct 2022 15:09:21 +0000
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <tjm431$6gt4$2@dont-email.me>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<tjilf4$3d93q$1@dont-email.me>
<21bfb08d-2c13-40d1-a8fb-cdec1676667dn@googlegroups.com>
<tjjihh$1hj1$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 30 Oct 2022 15:09:21 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="3c7339025101e5a74c921365f1dfc355";
logging-data="213924"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191PX9RsP30JxQw4s5LPzzqPWPjT2VcnZ8="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.0
Cancel-Lock: sha1:t58YyRaHf4/xD0v/nwCYGhA8cBI=
In-Reply-To: <tjjihh$1hj1$1@gioia.aioe.org>
 by: Gerry Jackson - Sun, 30 Oct 2022 15:09 UTC

On 29/10/2022 16:57, dxforth wrote:
> On 29/10/2022 7:05 pm, Marcel Hendrix wrote:
>>
>> FORTH> : concats ( ca1 u1 .. can un n -- ca u )  1- 0 max 0 ?DO  $+
>> LOOP ;
>> FORTH> S" Hello"  S" , "  S" world"  S" !"  4 concats
>> [2]FORTH> type Hello, world! ok
>
> : concats  <# 0 ?do holds loop 0 0 #> ;
>
> s" Hello"  s" , "  s" world"  s" !"  4 concats type Hello, world! ok
>

Yes that's much simpler even with the inelegance of having to provide 2
cells on the stack for #> to drop.

Seeing that solution is ironic and humbling. I knew that <# ... #> and
indeed have posted something about that on c.l.f in the past. I've no
explanation about why I didn't think of that in my response to Hans
Bezemer, I suppose his solution pointed me into using +PLACE and I
didn't think beyond that.

--
Gerry

Re: Another example of factoring and locals

<tjm5a6$6gt4$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: do-not-...@swldwa.uk (Gerry Jackson)
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Sun, 30 Oct 2022 15:30:14 +0000
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <tjm5a6$6gt4$3@dont-email.me>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<tjilf4$3d93q$1@dont-email.me>
<b913a769-dfc6-463a-ad06-70a989b844cdn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 30 Oct 2022 15:30:14 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="3c7339025101e5a74c921365f1dfc355";
logging-data="213924"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/nNoJk7fdYb7k3P+Fon9WNA4pQLUocLio="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.4.0
Cancel-Lock: sha1:yeHcgqDW9h9yBiZ0A7rrnZl6smA=
In-Reply-To: <b913a769-dfc6-463a-ad06-70a989b844cdn@googlegroups.com>
 by: Gerry Jackson - Sun, 30 Oct 2022 15:30 UTC

On 29/10/2022 14:14, Hans Bezemer wrote:
> On Saturday, October 29, 2022 at 9:41:27 AM UTC+2, Gerry Jackson wrote:
>> incorrect & misleading stack comment.
> I now see where your comment about "misleading stack comment" comes
> from. In 4tH ASCIIZ strings are used - and a2 is actually the address that is
> returned.

Sorry about that, I wasn't aware that 4th used zero terminated strings
and just assumed that standard counted strings were used. So presumably
your version of COUNT does it by actually counting the characters.
>
> That your code works is because the first line effectively terminates
> the target string - and the abstraction of +PLACE does the heavy lifting.
>

It's fortuitous that a 0 byte means an empty string for both ways of
representing a string.

> But I forgive you ;-)
Thank you

--
Gerry

Re: Another example of factoring and locals

<tjn000$1dl2$1@gioia.aioe.org>

  copy mid

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

  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: Another example of factoring and locals
Date: Mon, 31 Oct 2022 10:05:37 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tjn000$1dl2$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<ce91d2ea-b341-4539-afee-6fb40bf63172n@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="46754"; 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:102.0) Gecko/20100101
Thunderbird/102.4.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sun, 30 Oct 2022 23:05 UTC

On 30/10/2022 11:56 pm, S Jack wrote:
> On Sunday, October 30, 2022 at 1:16:24 AM UTC-5, dxforth wrote:
>>
>> http://www.ultratechnology.com/1xforth.htm
>
> ColorForth and Moore's vision are intriguing; however, I'm out of time
> for transforming into a "moti" and beginning new adventure. If I were
> younger, I would eagerly start with ColorForth and begin some endeavor of
> UXN like "Past proofing".

Chasing visions is likely to bring one back to where one started.

https://en.wikisource.org/wiki/Time_and_the_Gods#The_Sorrow_of_Search

Re: Another example of factoring and locals

<87ilk06ffc.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Sun, 30 Oct 2022 16:48:55 -0700
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <87ilk06ffc.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="b69eade6d0e1051b11ae4961600e09c0";
logging-data="337554"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qauP7lcZQL+VhQ1kdVrBF"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:qPb+g5nr1qaO65NYtCXP5YOcPQU=
sha1:3b9Vqm0+x4Mwp72/F16DD3BHPGw=
 by: Paul Rubin - Sun, 30 Oct 2022 23:48 UTC

dxforth <dxforth@gmail.com> writes:
> It appears he [Moore] found them superfluous:
> "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."

PICK and ROLL have to have come from somewhere: if it wasn't Moore, then
who? And what about ROT, -ROT, >R, and R>?

I get that Moore used VARIABLEs for everything that I'd use locals for.
He also used CODE when Forth got in the way too much.

Back in the 1970s, computers were limited, programs were necessarily
small, and Moore espoused rewriting programs from the ground up instead
of maintaining them. The main problem facing programmers was how to
make their program implement behaviour X, for whatever X happened to be
that day. They'd put a lot of effort into coding and testing X, and
then they were done.

Today, the main problem facing programmers is ensuring the absence of
behaviours rather than their presence. Writing code is way easier than
it used to be, because tools are better and computers are faster. But
maintaining is harder since programs are bigger and have more people
hacking at them. If you use a VARIABLE to save a temporary value used
by a word, then anyone modifying that word, when they see that variable,
now has to check that no other word uses the variable and depends on it
for communication. Or worse, communicates through the memory cell
occupied by that variable but through some sneaky alias. VALUE avoids
aliasing (no idea whether Moore used them), but locals make both issues
go away.

Finally, while I can't doubt Moore's genius, I've never understood the
vision that says the pure stack VM fits every programming problem.
Register allocation and spilling is one of the messier parts of
traditional compilers even when there are plenty of registers that don't
have weird special purposes. In Forth, there are only 3 or so
"registers" (T, N, and R), and each is special. Why be so vehement that
a human rather than a machine should be juggling them? I can understand
taht locals (if supported) complicate the traditional threaded Forth
interpreter, but I don't know how much Moore valued that. I know he did
like stack hardware (his many Forth chips) but that came later.

So the pure "stack plus VARIABLEs" seems "not even wrong" to me. I
don't understand the motivation behind it well enough to disagree per
se. And I've never seen an explanation that made sense. They have all
seemed like grasping at straws.

Re: Another example of factoring and locals

<tjn2sv$b9o$1@gioia.aioe.org>

  copy mid

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

  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: Another example of factoring and locals
Date: Mon, 31 Oct 2022 10:55:12 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tjn2sv$b9o$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<tjilf4$3d93q$1@dont-email.me>
<21bfb08d-2c13-40d1-a8fb-cdec1676667dn@googlegroups.com>
<tjjihh$1hj1$1@gioia.aioe.org> <tjm431$6gt4$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="11576"; 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:102.0) Gecko/20100101
Thunderbird/102.4.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Sun, 30 Oct 2022 23:55 UTC

On 31/10/2022 2:09 am, Gerry Jackson wrote:
> On 29/10/2022 16:57, dxforth wrote:
>> On 29/10/2022 7:05 pm, Marcel Hendrix wrote:
>>>
>>> FORTH> : concats ( ca1 u1 .. can un n -- ca u )  1- 0 max 0 ?DO  $+ LOOP ;
>>> FORTH> S" Hello"  S" , "  S" world"  S" !"  4 concats
>>> [2]FORTH> type Hello, world! ok
>>
>> : concats  <# 0 ?do holds loop 0 0 #> ;
>>
>> s" Hello"  s" , "  s" world"  s" !"  4 concats type Hello, world! ok
>>
>
> Yes that's much simpler even with the inelegance of having to provide 2 cells on the stack for #> to drop.
>
> Seeing that solution is ironic and humbling. I knew that <# ... #> and indeed have posted something about that on c.l.f in the past. I've no explanation about why I didn't think of that in my response to Hans Bezemer, I suppose his solution pointed me into using +PLACE and I didn't think beyond that.

I had considered an iterative solution similar to the original:

\ +string ( a1 u1 a2 u2 -- a2 u3 )

: concat ( a1 u1 ... an un n dest -- dest len )
0 0 begin 2>r over while swap 1- swap 2swap repeat
swap begin 2r> over while 2swap +string repeat 2drop ;

Not sure the problem is particularly real. Akin to painting oneself into
a corner then having to find a way out. There has to be a better way...

Re: Another example of factoring and locals

<tjn8al$1ssh$1@gioia.aioe.org>

  copy mid

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

  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: Another example of factoring and locals
Date: Mon, 31 Oct 2022 12:27:49 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tjn8al$1ssh$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<87ilk06ffc.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="62353"; 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:102.0) Gecko/20100101
Thunderbird/102.4.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Mon, 31 Oct 2022 01:27 UTC

On 31/10/2022 10:48 am, Paul Rubin wrote:
> dxforth <dxforth@gmail.com> writes:
>> It appears he [Moore] found them superfluous:
>> "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."
>
> PICK and ROLL have to have come from somewhere: if it wasn't Moore, then
> who? And what about ROT, -ROT, >R, and R>?
>
> I get that Moore used VARIABLEs for everything that I'd use locals for.

You use locals because it's easier and more-or-less idiot-proof. Moore
claims it leads to inefficiency. Can't speak for his use but if I have
to use a variable as a temp, I do so sparingly - unlike locals which are
largely about 'readability' and therefore quantity.

> He also used CODE when Forth got in the way too much.

Don't know but when it comes to apps there's has to be a good enough
reason before I'll use CODE.

> Today, the main problem facing programmers is ensuring the absence of
> behaviours rather than their presence. Writing code is way easier than
> it used to be, because tools are better and computers are faster. But
> maintaining is harder since programs are bigger and have more people
> hacking at them. If you use a VARIABLE to save a temporary value used
> by a word, then anyone modifying that word, when they see that variable,
> now has to check that no other word uses the variable and depends on it
> for communication. Or worse, communicates through the memory cell
> occupied by that variable but through some sneaky alias. VALUE avoids
> aliasing (no idea whether Moore used them), but locals make both issues
> go away.

I think you overstate such use of variables, but how are they a problem
when defined local to the routine which uses it?

>
> Finally, while I can't doubt Moore's genius, I've never understood the
> vision that says the pure stack VM fits every programming problem.

Saving the world is tough - even for the newer programming systems you
talk about. For me, it's enough that I've been able to create a tool
I'm both comfortable using and is challenging at the same time.

Re: Another example of factoring and locals

<87eduo694u.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Sun, 30 Oct 2022 19:04:49 -0700
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <87eduo694u.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<87ilk06ffc.fsf@nightsong.com> <tjn8al$1ssh$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="b69eade6d0e1051b11ae4961600e09c0";
logging-data="353650"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DFdXV3gpBrd2bHL0l0sgm"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:TgKWmAOBIZTP8WYWMZ6uaDCRmDA=
sha1:1B+Ygn9B6EdtgUWJ9xtxd+NwgPc=
 by: Paul Rubin - Mon, 31 Oct 2022 02:04 UTC

dxforth <dxforth@gmail.com> writes:
> You use locals because it's easier and more-or-less idiot-proof. Moore
> claims it leads to inefficiency.

Yes, idiot proofing is always a good goal when programming ;). The
inefficiency depends on the implementation, I'd expect. It may also be
that code execution profiles have changed since Moore's heyday. DJB
made that claim in an article called "Demise Of The Optimizing Compiler"
or some such. Basically the execution time of programs nowadays is
concentrated almost entirely in a few hot spots. Those spots may have
to be tuned for efficiency, but the rest of the program's efficiency
almost doesn't matter. It was different in the 1970s, where efficiency
mattered everywhere in the program.

> if I have to use a variable as a temp, I do so sparingly - unlike
> locals which are largely about 'readability' and therefore quantity.

Not sure what you mean about quantity, but I look at the gforth manual's
locals version of MAX compared with a traditional one (both untested):

: max1 ( a b -- max ) 2dup > if drop else nip then ;
: max2 { a b -- max } a b > if a else b then ;

the locals version has less source code and (if compiled) maybe less
object code as well.

Similarly you recently posted elsewhere (158 source chars):

: concat ( a1 u1 ... an un n dest -- dest len )
0 0 begin 2>r over while swap 1- swap 2swap repeat
swap begin 2r> over while 2swap +string repeat 2drop ;

A locals version (untested) is 165 chars mostly due to extra whitespace
that could be squished out:

: concat2 ( a1 u1 ... an un n dest -- dest len )
{ n dest } 0 { len }
n 0 ?do
{ a u } a u dest len +string
u len + to len
loop
dest len ;

I can't begin to understand the stack juggling version so can't be sure
the two do the same thing. I also don't see how to implement 2SWAP with
just DUP, DROP, OVER. I guess it could be done with variables.

> I think you overstate such use of variables, but how are they a problem
> when defined local to the routine which uses it?

How do you do that? Variables are always globals, I thought. Another
issue with them that I forgot to mention is non-reentrancy. Like if you
implement 2SWAP with variables and an interrupt handler uses it while
another call to 2SWAP is in progress, you get a Heisenbug. Oops.

> Saving the world is tough - even for the newer programming systems you
> talk about. For me, it's enough that I've been able to create a tool
> I'm both comfortable using and is challenging at the same time.

I like my tools to be comfortable and powerful. Challenge should come
from using them on bigger and tougher problems, not from making even
easy problems a pain to solve.

Re: Another example of factoring and locals

<02026cae-ed9d-4708-9e42-064868654c91n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:28ce:b0:6cf:933c:40d3 with SMTP id l14-20020a05620a28ce00b006cf933c40d3mr7423957qkp.258.1667184242311;
Sun, 30 Oct 2022 19:44:02 -0700 (PDT)
X-Received: by 2002:a0d:f446:0:b0:34d:4deb:1155 with SMTP id
d67-20020a0df446000000b0034d4deb1155mr10886714ywf.245.1667184242117; Sun, 30
Oct 2022 19:44:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Sun, 30 Oct 2022 19:44:01 -0700 (PDT)
In-Reply-To: <87eduo694u.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:409:8400:1228:94b7:690b:32af:89ab;
posting-account=YrYQiQoAAAB3ECk4vm4OgA6KUu5AcEY0
NNTP-Posting-Host: 2601:409:8400:1228:94b7:690b:32af:89ab
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at> <tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com> <2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com> <74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<87ilk06ffc.fsf@nightsong.com> <tjn8al$1ssh$1@gioia.aioe.org> <87eduo694u.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <02026cae-ed9d-4708-9e42-064868654c91n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: dhoffman...@gmail.com (Doug Hoffman)
Injection-Date: Mon, 31 Oct 2022 02:44:02 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2515
 by: Doug Hoffman - Mon, 31 Oct 2022 02:44 UTC

On Sunday, October 30, 2022 at 10:05:16 PM UTC-4, Paul Rubin wrote:

> I also don't see how to implement 2SWAP with
> just DUP, DROP, OVER.

Use the return stack as a "local variable holder"
and use ROT and SWAP.

: 2swap ( x1 x2 x3 x4 -- x3 x4 x1 x2 )
>r rot rot r> swap rot swap ;

Truthfully, I don't see much difference between conventional locals
and using the return stack for same. With the latter you don't get names
though it is likely more efficient. But IMO is just as "impure" as locals.
Locals are much easier to use/debug/maintain-changes. If you are
not resource limited and the locals version is fast enough then I
leave it at that.

-Doug

Re: Another example of factoring and locals

<87a65c66u4.fsf@nightsong.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Sun, 30 Oct 2022 19:54:27 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <87a65c66u4.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<87ilk06ffc.fsf@nightsong.com> <tjn8al$1ssh$1@gioia.aioe.org>
<87eduo694u.fsf@nightsong.com>
<02026cae-ed9d-4708-9e42-064868654c91n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="b69eade6d0e1051b11ae4961600e09c0";
logging-data="358891"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7LNXgYY+xZltRGYzS3bgx"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:NHmwLAwdLTBj8iQaudGoIKSSZXk=
sha1:sByeGzxfjcKpvXaE91jCUHEstSk=
 by: Paul Rubin - Mon, 31 Oct 2022 02:54 UTC

Doug Hoffman <dhoffman888@gmail.com> writes:
>> I also don't see how to implement 2SWAP with just DUP, DROP, OVER.
> Use the return stack as a "local variable holder"
> and use ROT and SWAP.

I'm doing by the quote from Chuck Moore about DUP, DROP, and OVER (and
maybe SWAP) being the only legit stack primitives, so no ROT. He does
use the return stack in his own code though.

> Truthfully, I don't see much difference between conventional locals
> and using the return stack for same.

There is no RPICK in standard Forth, so you can't get at the internal
slots. Moore even frowns on regular PICK. Also, you have to be able to
pop the locals if the word exits through an exception. (LOCAL) had to
be added to the standard to allow that, since the VM has to handle the
unwinding in that situation.

Re: Another example of factoring and locals

<tjnepg$1lhq$1@gioia.aioe.org>

  copy mid

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

  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: Another example of factoring and locals
Date: Mon, 31 Oct 2022 14:18:07 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tjnepg$1lhq$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjcuft$1hjp$1@gioia.aioe.org> <2022Oct27.123214@mips.complang.tuwien.ac.at>
<tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com>
<2022Oct27.182441@mips.complang.tuwien.ac.at> <tjg2qm$1lbd$1@gioia.aioe.org>
<87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com>
<74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<87ilk06ffc.fsf@nightsong.com> <tjn8al$1ssh$1@gioia.aioe.org>
<87eduo694u.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="54842"; 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:102.0) Gecko/20100101
Thunderbird/102.4.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Mon, 31 Oct 2022 03:18 UTC

On 31/10/2022 1:04 pm, Paul Rubin wrote:
> dxforth <dxforth@gmail.com> writes:
>
>> if I have to use a variable as a temp, I do so sparingly - unlike
>> locals which are largely about 'readability' and therefore quantity.
>
> Not sure what you mean about quantity, but I look at the gforth manual's
> locals version of MAX compared with a traditional one (both untested):
>
> : max1 ( a b -- max ) 2dup > if drop else nip then ;
> : max2 { a b -- max } a b > if a else b then ;
>
> the locals version has less source code and (if compiled) maybe less
> object code as well.

I'd have written:

: max1 ( a b -- max ) 2dup < if swap then drop ;

Compare them under VFX and see what you get.

> Similarly you recently posted elsewhere (158 source chars):
>
> : concat ( a1 u1 ... an un n dest -- dest len )
> 0 0 begin 2>r over while swap 1- swap 2swap repeat
> swap begin 2r> over while 2swap +string repeat 2drop ;
>
> A locals version (untested) is 165 chars mostly due to extra whitespace
> that could be squished out:
>
> : concat2 ( a1 u1 ... an un n dest -- dest len )
> { n dest } 0 { len }
> n 0 ?do
> { a u } a u dest len +string
> u len + to len
> loop
> dest len ;
>
> I can't begin to understand the stack juggling version so can't be sure
> the two do the same thing.

Ditto for me for the locals version. Perhaps it's a matter of what one
is used to? If one's goal is to jump between languages using more or
less the same code, then maybe you'll want to use locals in Forth.
Personally I don't and think it a terrible idea.

>> I think you overstate such use of variables, but how are they a problem
>> when defined local to the routine which uses it?
>
> How do you do that? Variables are always globals, I thought.

Give an example how it's a problem.

> Another
> issue with them that I forgot to mention is non-reentrancy. Like if you
> implement 2SWAP with variables and an interrupt handler uses it while
> another call to 2SWAP is in progress, you get a Heisenbug. Oops.

You could make it a USER variable :)

Re: Another example of factoring and locals

<0413dab6-0f98-48bc-9000-ad27a7f994c6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:6214:242a:b0:4bb:96d3:e92d with SMTP id gy10-20020a056214242a00b004bb96d3e92dmr9862987qvb.7.1667205608716;
Mon, 31 Oct 2022 01:40:08 -0700 (PDT)
X-Received: by 2002:a25:4a41:0:b0:6cb:dfc2:8856 with SMTP id
x62-20020a254a41000000b006cbdfc28856mr11555366yba.635.1667205608510; Mon, 31
Oct 2022 01:40:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Mon, 31 Oct 2022 01:40:08 -0700 (PDT)
In-Reply-To: <02026cae-ed9d-4708-9e42-064868654c91n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.174.47.232; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 77.174.47.232
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at> <tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com> <2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com> <74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<87ilk06ffc.fsf@nightsong.com> <tjn8al$1ssh$1@gioia.aioe.org>
<87eduo694u.fsf@nightsong.com> <02026cae-ed9d-4708-9e42-064868654c91n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0413dab6-0f98-48bc-9000-ad27a7f994c6n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Mon, 31 Oct 2022 08:40:08 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2530
 by: Hans Bezemer - Mon, 31 Oct 2022 08:40 UTC

On Monday, October 31, 2022 at 3:44:03 AM UTC+1, Doug Hoffman wrote:
> On Sunday, October 30, 2022 at 10:05:16 PM UTC-4, Paul Rubin wrote:
>
> > I also don't see how to implement 2SWAP with
> > just DUP, DROP, OVER.
> Use the return stack as a "local variable holder"
> and use ROT and SWAP.
>
> : 2swap ( x1 x2 x3 x4 -- x3 x4 x1 x2 )
> >r rot rot r> swap rot swap ;
Really?! Even my computer can do better!

$ pp4th -x stackopt.4th abcd cdab
- Trying a 1 word solution..
No solutions.
- Trying a 2 word solution..
No solutions.
- Trying a 3 word solution..
No solutions.
- Trying a 4 word solution..
rot >r rot r>

Hans Bezemer

Re: Another example of factoring and locals

<12932144-da1b-487b-a46c-1c004c3e872bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:7dc4:0:b0:39c:f95f:57fe with SMTP id c4-20020ac87dc4000000b0039cf95f57femr9423280qte.612.1667205681343;
Mon, 31 Oct 2022 01:41:21 -0700 (PDT)
X-Received: by 2002:a81:1a03:0:b0:36a:8a65:f6a7 with SMTP id
a3-20020a811a03000000b0036a8a65f6a7mr12316639ywa.457.1667205681207; Mon, 31
Oct 2022 01:41:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Mon, 31 Oct 2022 01:41:20 -0700 (PDT)
In-Reply-To: <87eduo694u.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.174.47.232; posting-account=Ebqe4AoAAABfjCRL4ZqOHWv4jv5ZU4Cs
NNTP-Posting-Host: 77.174.47.232
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjcuft$1hjp$1@gioia.aioe.org>
<2022Oct27.123214@mips.complang.tuwien.ac.at> <tjdt15$1s0n$1@gioia.aioe.org>
<df3724de-f372-4c24-8bf4-059962363089n@googlegroups.com> <2022Oct27.182441@mips.complang.tuwien.ac.at>
<tjg2qm$1lbd$1@gioia.aioe.org> <87bkpw73fr.fsf@nightsong.com>
<30befe81-28a6-4022-a383-b118dcefc892n@googlegroups.com> <74d9d175-1aea-4eef-9ccd-d2417cd9950bn@googlegroups.com>
<874jvn74e3.fsf@nightsong.com> <tjic8e$qbm$1@gioia.aioe.org>
<87v8o25nhu.fsf@nightsong.com> <tjklqe$g5m$1@gioia.aioe.org>
<87r0yp6fdk.fsf@nightsong.com> <tjl4rl$fmb$1@gioia.aioe.org>
<87ilk06ffc.fsf@nightsong.com> <tjn8al$1ssh$1@gioia.aioe.org> <87eduo694u.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <12932144-da1b-487b-a46c-1c004c3e872bn@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Mon, 31 Oct 2022 08:41:21 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2042
 by: Hans Bezemer - Mon, 31 Oct 2022 08:41 UTC

On Monday, October 31, 2022 at 3:05:16 AM UTC+1, Paul Rubin wrote:
> dxforth <dxf...@gmail.com> writes:
> Yes, idiot proofing is always a good goal when programming ;).
According to both Moore and Dijkstra, idiots shouldn't be programming.

Hans Bezemer

Re: Another example of factoring and locals

<nnd$270c7f4c$69747218@3bf638c064723f3c>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjl4rl$fmb$1@gioia.aioe.org> <87ilk06ffc.fsf@nightsong.com> <tjn8al$1ssh$1@gioia.aioe.org>
Subject: Re: Another example of factoring and locals
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$270c7f4c$69747218@3bf638c064723f3c>
Organization: KPN B.V.
Date: Mon, 31 Oct 2022 11:15:26 +0100
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.uzoreto.com!feeder.usenetexpress.com!tr1.eu1.usenetexpress.com!94.232.112.244.MISMATCH!feed.abavia.com!abe004.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 71
Injection-Date: Mon, 31 Oct 2022 11:15:26 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: none - Mon, 31 Oct 2022 10:15 UTC

In article <tjn8al$1ssh$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote:
>On 31/10/2022 10:48 am, Paul Rubin wrote:
>> dxforth <dxforth@gmail.com> writes:
>>> It appears he [Moore] found them superfluous:
>>> "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."
>>
>> PICK and ROLL have to have come from somewhere: if it wasn't Moore, then
>> who? And what about ROT, -ROT, >R, and R>?
>>
>> I get that Moore used VARIABLEs for everything that I'd use locals for.
>
>You use locals because it's easier and more-or-less idiot-proof. Moore
>claims it leads to inefficiency. Can't speak for his use but if I have
>to use a variable as a temp, I do so sparingly - unlike locals which are
>largely about 'readability' and therefore quantity.

locals is not enough, you need dlocals,flocals
You are actually brains washed by c.
"
#include whatever

int gcd( int a, int b)
{ float hesp;
double x;
long int x ;
hesp inteact(a, x);
return items(a, hesp);
} "
You can have this type behaviour. with

VOCABULARY gcdlist ALSO gcdlist

int a int b
float hesp
double x
long_int x
: gcd
b ! a !
a @ x 2@ hesp F@ inteact hesp F!
a @ ,hesp F@ items
;

previous

It is good that you are not looking at Pascal, then
we would have local definitions adding to the
abominations of the local type zoo (LOCAL FLOCAL DLOCAL DFLOCAL ..)

In the above picture we could easily add after
long_int x
the line
: inteact do this do that mysterious F@ ;

proving the superiority of classical approach of forth.

I can't stand the idea that so,eome duplicates VARIABLE
into VALUES (it is sooo much works to fetch them..)
and then LOCAL VALUES (duplicating the scope restriction
that are present in Forth).

Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst


devel / comp.lang.forth / Re: Another example of factoring and locals

Pages:123456789
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor