Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Time sharing: The use of many people by the computer.


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

<87cza4g1do.fsf@nightsong.com>

  copy mid

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

  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: Wed, 02 Nov 2022 20:31:15 -0700
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <87cza4g1do.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>
<tji5tj$13t5$1@gioia.aioe.org> <87wn8d0z9g.fsf@nightsong.com>
<tjva23$120s$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="1b825525f395ae7931c686911d6726ac";
logging-data="1471248"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19S2uvcJUGIalP1eQffgJGy"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:8LQF5b82NDuKX0ihnd2c6JQVsZs=
sha1:bLBU3hpuFTMmY7yJLwFCYjVwUUo=
 by: Paul Rubin - Thu, 3 Nov 2022 03:31 UTC

dxforth <dxforth@gmail.com> writes:
> My point was it went from 4 locals to 6 for reasons of style. It may be
> C-style to expend resources this way (I wouldn't know)

In C these days, the extra locals wouldn't expend any resources in most
cases, since the compiler would optimize them away.

> but I doubt it's Moore's.

This I don't know. A traditional thread Forth interpreter (Moore's
invention) is probably 10x slower than CODE doing the same thing, but
Moore only used CODE when he had to. If 9x extra compute cycles is
fine, why are a few memory cells a big deal?

There's a similar thing from the Forth stylistic convention that words
should consume their arguments. The convention makes your code more
understandable but it means consuming a little more data stack space
than necessary, and running some extra dups and drops.

> But what are implications of using locals in Forth? It's this: A
> stack-based language that cannot exist without the help of locals has
> failed and therefore does not deserve to exist.

Well, Moore used VARIABLEs instead of locals, so the pure stack vision
already failed because of that. One could simply say Forth works better
in the presence of some impurity. Locals are another, perhaps cleaner,
way to add the impurity.

There is a similar thing in functional programming called "point-free
style". That style avoids using named function parameters, so instead
of "f x = sqrt (sin x)" you'd say "f = sqrt . sin". Nice, but it can
get really confusing, like "f x y z = (x+y)*z" becomes "f = ((*) .) . (+)".

Point-free is a nice theoretical construct and you can apparently
write every program that way, but for practical purposes it's much nicer
to use named parameters except in the simpler cases. The feeling of
point-free coding is not that much different from Forth stackrobatics.
It can be fun but if your goal is to write programs that work, it's
not that good a use of mental energy.

Re: Another example of factoring and locals

<tjvdqh$3vo$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!NZ87pNe1TKxNDknVl4tZhw.user.46.165.242.91.POSTED!not-for-mail
From: antis...@math.uni.wroc.pl
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
Date: Thu, 3 Nov 2022 03:50:41 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <tjvdqh$3vo$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <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> <tjr6ck$udi$1@gioia.aioe.org> <780333d7-0a35-43f5-a923-9bd737e93cf5n@googlegroups.com>
Injection-Info: gioia.aioe.org; logging-data="4088"; posting-host="NZ87pNe1TKxNDknVl4tZhw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: tin/2.4.5-20201224 ("Glen Albyn") (Linux/5.10.0-9-amd64 (x86_64))
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:ZzAsPY+uo9YPWbAhGh97YTf7c+g=
 by: antis...@math.uni.wroc.pl - Thu, 3 Nov 2022 03:50 UTC

Hans Bezemer <the.beez.speaks@gmail.com> wrote:
> On Tuesday, November 1, 2022 at 2:19:21 PM UTC+1, anti...@math.uni.wroc.pl wrote:
> > I think that some voices here vastly overestimate extra complexity.
> I did locals in my uBASIC interpreter - because it's BASIC - a Fortran
> derivative - it's fitting. But it requires setting up and releasing a stack frame,
> copying values there - that's a whole lot of overhead. For some ugly C-ism.
> As if we didn't have enough of those in ANS Forth.

Copying values is not really overhead. Normally values are copied
because you need to preserve them, so it is part of computation
and needs to be done one way or anouther. In fact, bulk copy
in many cases is most officient way to do this.
> > AFAICS at runtime it is enough to have bunch of extra primitives:
> > add and subtract from return stack pointer (could be single primitive)
> > and two primitives fpr each local, one for reading, the other for
> > storing. If one sticks to standard limit of 16 locals that is 33
> > primitives. And they are very simple, one or two machine instructions
> > for real work (plus whatever boilerplate is needed for dispatch).
> 33 primitives? And you call that "minor overhead"? My entire VM has about
> 100 primitives.

I am not sure what is troubling you here. That they are called
"primitives"? Access primitives are very simple and very similar
to each other, conceptually there is almost no increase in complexity.
That they need to be coded in assembler? Albert's ciforth has about
300 words defiend in assembler, and from glance at his code I think
that most is longer than proposed primitives. So it seems that one
would get 5-7% increase in amount of assembler code and to that
matter simpler than much of the rest. Of course, you may that pride
that you need less assember code. However, I take pragmatic view
here: assembler is problematic because one can do tricky things
which are hard to understand. But the primitives are so simple that
there is not problem with understanding.

One extra remark: as Anton noted instead of 32 access primitives
I could use just 2. But AFACS in threaded code each use of
Anton version would add 2 words of code (one for primitive itself,
second for parameter). And assembly code of primitive would
be a bit more complex. My version when used needs just one
word of code. And assembly should be pretty efficient, at least
as efficient as named constant or value and possibly more efficient.
Which means that when used in good way locals should lead to
smaller and more efficient code.

Maybe you are worried about used dictionary slots? AFAICS Forthers
are not shy about defining small special purpose words that
get used once or twice. Looking at extras for Mecrisp I saw
MCU definition files that define hundreds of constants, so even
for small targets people use a lot dictionary slots. So,
I call those 33 slots minor overhead.

And you may not belive, but I have reasons to think that
using locals within Forth implementation (not for style, but
when it leads to gain!) would make code smaller, likely
compensating space taken by primitives.

--
Waldek Hebisch

Re: Another example of factoring and locals

<tjvevs$cva$1@gioia.aioe.org>

  copy mid

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

  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: Thu, 3 Nov 2022 15:10:36 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tjvevs$cva$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> <tji5tj$13t5$1@gioia.aioe.org>
<87wn8d0z9g.fsf@nightsong.com> <tjva23$120s$1@gioia.aioe.org>
<87cza4g1do.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="13290"; 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 - Thu, 3 Nov 2022 04:10 UTC

On 3/11/2022 2:31 pm, Paul Rubin wrote:
> dxforth <dxforth@gmail.com> writes:
>> My point was it went from 4 locals to 6 for reasons of style. It may be
>> C-style to expend resources this way (I wouldn't know)
>
> In C these days, the extra locals wouldn't expend any resources in most
> cases, since the compiler would optimize them away.

AFAIK optimizers do a better job when the code presented is already optimal.

>> But what are implications of using locals in Forth? It's this: A
>> stack-based language that cannot exist without the help of locals has
>> failed and therefore does not deserve to exist.
>
> Well, Moore used VARIABLEs instead of locals, so the pure stack vision
> already failed because of that.

Does he?

> One could simply say Forth works better
> in the presence of some impurity. Locals are another, perhaps cleaner,
> way to add the impurity.

Well, in that case I'd say you're more desperate to use Forth than I am.
No way would I tolerate using a broken language :)

Re: Another example of factoring and locals

<874jvgfyc9.fsf@nightsong.com>

  copy mid

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

  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: Wed, 02 Nov 2022 21:36:54 -0700
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <874jvgfyc9.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>
<tji5tj$13t5$1@gioia.aioe.org> <87wn8d0z9g.fsf@nightsong.com>
<tjva23$120s$1@gioia.aioe.org> <87cza4g1do.fsf@nightsong.com>
<tjvevs$cva$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="1b825525f395ae7931c686911d6726ac";
logging-data="1477903"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7+tyAZzTJwgDQWqzSTHIM"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:jmbfJhzgTVh9yhK8KN7JtuBbwiI=
sha1:XDhDt4PqLPT906CSI6LCmRDuf2c=
 by: Paul Rubin - Thu, 3 Nov 2022 04:36 UTC

dxforth <dxforth@gmail.com> writes:
> AFAIK optimizers do a better job when the code presented is already optimal.

These days optimizers work by first splitting everything out into
separate variables so that nothing is ever updated (static single
assignment or SSA form), and then recombining the variables. I have
never implemented SSA and don't understand it perfectly, but I believe
the SSA forms of the 4-local and 6-local versions of that code would be
very similar. Anton would know this much better than I do.

>> Well, Moore used VARIABLEs instead of locals,
> Does he?

I believe so. I remember looking at cmforth and some of the GA144 code
and seeing variables used that way. I also remember asking Elizabeth
about the complex multiplication example, and her replying that Moore
didn't hesitate to use CODE if it made things easier. He wasn't a
purist about staying with Forth words.

In the 1970s there just wasn't room for purity in software. Maybe APL
came closest. Lisp was born from the most purest mathematical
abstraction (lambda calculus) but its implementations were full of low
level hackery. The purest language now is Haskell but it is also full
of hacks.

Re: Another example of factoring and locals

<tjvjju$1h3j$1@gioia.aioe.org>

  copy mid

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

  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: Thu, 3 Nov 2022 16:29:34 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tjvjju$1h3j$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> <tji5tj$13t5$1@gioia.aioe.org>
<87wn8d0z9g.fsf@nightsong.com> <tjva23$120s$1@gioia.aioe.org>
<87cza4g1do.fsf@nightsong.com> <tjvevs$cva$1@gioia.aioe.org>
<874jvgfyc9.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="50291"; 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 - Thu, 3 Nov 2022 05:29 UTC

On 3/11/2022 3:36 pm, Paul Rubin wrote:
> dxforth <dxforth@gmail.com> writes:
> [...]
>>> Well, Moore used VARIABLEs instead of locals,
>> Does he?
>
> I believe so. I remember looking at cmforth and some of the GA144 code
> and seeing variables used that way. I also remember asking Elizabeth
> about the complex multiplication example, and her replying that Moore
> didn't hesitate to use CODE if it made things easier. He wasn't a
> purist about staying with Forth words.

I've nothing against the occasional variable or CODE when it makes sense.
That's a different proposition to dumping everything to locals because
one views stack operators as either ugly or clumsy.

> In the 1970s there just wasn't room for purity in software. Maybe APL
> came closest. Lisp was born from the most purest mathematical
> abstraction (lambda calculus) but its implementations were full of low
> level hackery. The purest language now is Haskell but it is also full
> of hacks.

You've read Moore's stance on locals, which has never changed. Others
will go where their interest and thinking takes them. It's not my problem.
My interest is in discovering whether Moore's system works. I can't do
that if I'm using locals.

Re: Another example of factoring and locals

<5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:cc5:b0:6fa:29f2:53df with SMTP id b5-20020a05620a0cc500b006fa29f253dfmr16152684qkj.194.1667472009774;
Thu, 03 Nov 2022 03:40:09 -0700 (PDT)
X-Received: by 2002:a05:6902:305:b0:6c3:b4d6:7a04 with SMTP id
b5-20020a056902030500b006c3b4d67a04mr27357809ybs.93.1667472009573; Thu, 03
Nov 2022 03:40:09 -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: Thu, 3 Nov 2022 03:40:09 -0700 (PDT)
In-Reply-To: <tjra46$gid$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:409:8400:1228:9983:f58a:3a51:5f6f;
posting-account=YrYQiQoAAAB3ECk4vm4OgA6KUu5AcEY0
NNTP-Posting-Host: 2601:409:8400:1228:9983:f58a:3a51:5f6f
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>
<87a65c66u4.fsf@nightsong.com> <b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org> <19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: dhoffman...@gmail.com (Doug Hoffman)
Injection-Date: Thu, 03 Nov 2022 10:40:09 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3158
 by: Doug Hoffman - Thu, 3 Nov 2022 10:40 UTC

On Tuesday, November 1, 2022 at 10:23:07 AM UTC-4, dxforth wrote:
> On 1/11/2022 10:44 pm, Doug Hoffman wrote:
> > On Monday, October 31, 2022 at 11:46:55 PM UTC-4, dxforth wrote:
> >
> >> 'These same people' are judicious in their use of return stack.

As am I and I believe everyone else I've seen use the return stack
to stash data stack items.


> > I'm a habitual user of the return stack when it is all
> > I need (as opposed to resorting to locals).

As am I.
Did I say that all colon definitions I write use locals?

> Are you saying ... that it's your choice to extend [Forth]
> with locals?

You give me too much credit. I have never extended a Forth
to have locals. The experts that created VFXForth, SwiftForth,
iForth, Gforth, iMops, and other Forths have already done it.

> If Forth is inadequate it would mean I've wasted 40 years on
> a bum steer. Locals users too.

I don't follow that logic. How could the way I, or anyone else,
use Forth impact whether or not you have wasted your time?

-Doug

Re: Another example of factoring and locals

<nnd$100bb0b5$745f63e2@4ef6be08da480aa9>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjr6ck$udi$1@gioia.aioe.org> <780333d7-0a35-43f5-a923-9bd737e93cf5n@googlegroups.com> <tjvdqh$3vo$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$100bb0b5$745f63e2@4ef6be08da480aa9>
Organization: KPN B.V.
Date: Thu, 03 Nov 2022 12:13:38 +0100
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!feeder.usenetexpress.com!tr2.eu1.usenetexpress.com!94.232.112.246.MISMATCH!feed.abavia.com!abe006.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 150
Injection-Date: Thu, 03 Nov 2022 12:13:38 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: none - Thu, 3 Nov 2022 11:13 UTC

In article <tjvdqh$3vo$1@gioia.aioe.org>, <antispam@math.uni.wroc.pl> wrote:
>
>One extra remark: as Anton noted instead of 32 access primitives
>I could use just 2. But AFACS in threaded code each use of
>Anton version would add 2 words of code (one for primitive itself,
>second for parameter). And assembly code of primitive would
>be a bit more complex. My version when used needs just one
>word of code. And assembly should be pretty efficient, at least
>as efficient as named constant or value and possibly more efficient.
>Which means that when used in good way locals should lead to
>smaller and more efficient code.
>
>Maybe you are worried about used dictionary slots? AFAICS Forthers
>are not shy about defining small special purpose words that
>get used once or twice. Looking at extras for Mecrisp I saw
>MCU definition files that define hundreds of constants, so even
>for small targets people use a lot dictionary slots. So,
>I call those 33 slots minor overhead.
>
<SNIP>
>I am not sure what is troubling you here. That they are called
>"primitives"? Access primitives are very simple and very similar
>to each other, conceptually there is almost no increase in complexity.
>That they need to be coded in assembler? Albert's ciforth has about
>300 words defiend in assembler, and from glance at his code I think
>that most is longer than proposed primitives. So it seems that one
>would get 5-7% increase in amount of assembler code and to that
>matter simpler than much of the rest. Of course, you may that pride
>that you need less assember code. However, I take pragmatic view
>here: assembler is problematic because one can do tricky things
>which are hard to understand. But the primitives are so simple that
>there is not problem with understanding.

Putting the record straight:
ciforth has 300 core words, but there are only 82+3 code words.
Please point out what is not deemed a primitive in the following list:

Code definition : NOOP
Code definition : LIT
Code definition : EXECUTE
Code definition : SKIP
Code definition : 0BRANCH
Code definition : (+LOOP)
Code definition : (DO)
Code definition : (?DO)
Code definition : I
Code definition : J
Code definition : UNLOOP
Code definition : CMOVE
Code definition : MOVE
Code definition : FARMOVE
Code definition : UM*
Code definition : UM/MOD
Code definition : AND
Code definition : OR
Code definition : XOR
Code definition : INVERT
Code definition : DSP@
Code definition : DSP!
Code definition : RSP@
Code definition : RSP!
Code definition : EXIT
Code definition : CO
Code definition : >R
Code definition : R>
Code definition : RDROP
Code definition : 0=
Code definition : 0<
Code definition : +
Code definition : D+
Code definition : NEGATE
Code definition : DNEGATE
Code definition : OVER
Code definition : DROP
Code definition : NIP
Code definition : 2DROP
Code definition : SWAP
Code definition : DUP
Code definition : 2DUP
Code definition : 2SWAP
Code definition : 2OVER
Code definition : +!
Code definition : TOGGLE
Code definition : @
Code definition : C@
Code definition : 2@
Code definition : !
Code definition : C!
Code definition : 2!
Code definition : FAR@
Code definition : FAR!
Code definition : _
Code definition : $@
Code definition : ALIGNED
Code definition : -
Code definition : =
Code definition : <
Code definition : U<
Code definition : <>
Code definition : ROT
Code definition : FILL
Code definition : CORA
Code definition : $^
Code definition : $/
Code definition : $\
Code definition : S>D
Code definition : LSHIFT
Code definition : RSHIFT
Code definition : M*
Code definition : SM/REM
Code definition : 2/
Code definition : 2*
Code definition : PC@
Code definition : PC!
Code definition : PW@
Code definition : PW!
Code definition : XOS
Code definition : XOS5
Alias : BRANCH
Alias : (;)
Alias : : R@

<SNIP>
>And you may not belive, but I have reasons to think that
>using locals within Forth implementation (not for style, but
>when it leads to gain!) would make code smaller, likely
>compensating space taken by primitives.

Interesting observation, but it doesn't chime with me.
A can't think of a high level word in the kernel that
would benefit from locals.

This is about as bad at it gets (decompiled, not formatted):
: FORGET-VOC 2DUP SWAP U< IF SWAP >R >WID BEGIN DUP DUP BEGIN >LFA @
DUP R@ U< UNTIL SWAP >LFA ! >LFA @ DUP 0= UNTIL DROP R> ELSE >VFA @
VOC-LINK ! ONLY FORTH DEFINITIONS THEN ;

Note that I think nothing of tucking away something on the return
stack that I need later. IMO it beats coming up with a sensible
name for a local.

Waldek Hebisch

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

Re: Another example of factoring and locals

<cc678ca2-49bc-4b21-b7c5-c49391d0a408n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ae9:e018:0:b0:6fa:49f6:7627 with SMTP id m24-20020ae9e018000000b006fa49f67627mr10374200qkk.518.1667480782707;
Thu, 03 Nov 2022 06:06:22 -0700 (PDT)
X-Received: by 2002:a81:c11:0:b0:36a:bcf0:6340 with SMTP id
17-20020a810c11000000b0036abcf06340mr28272643ywm.467.1667480782504; Thu, 03
Nov 2022 06:06:22 -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: Thu, 3 Nov 2022 06:06:22 -0700 (PDT)
In-Reply-To: <tjvjju$1h3j$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f14:6b49:f869:524c:56fc:1c34;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f14:6b49:f869:524c:56fc:1c34
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>
<tji5tj$13t5$1@gioia.aioe.org> <87wn8d0z9g.fsf@nightsong.com>
<tjva23$120s$1@gioia.aioe.org> <87cza4g1do.fsf@nightsong.com>
<tjvevs$cva$1@gioia.aioe.org> <874jvgfyc9.fsf@nightsong.com> <tjvjju$1h3j$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cc678ca2-49bc-4b21-b7c5-c49391d0a408n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Thu, 03 Nov 2022 13:06:22 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1853
 by: minf...@arcor.de - Thu, 3 Nov 2022 13:06 UTC

dxforth schrieb am Donnerstag, 3. November 2022 um 06:29:37 UTC+1:
> My interest is in discovering whether Moore's system works.

Did it work for himself? I gathered that he changed it all the time.

Re: Another example of factoring and locals

<87tu3gc77i.fsf@nightsong.com>

  copy mid

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

  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: Thu, 03 Nov 2022 09:51:13 -0700
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <87tu3gc77i.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjr6ck$udi$1@gioia.aioe.org>
<780333d7-0a35-43f5-a923-9bd737e93cf5n@googlegroups.com>
<tjvdqh$3vo$1@gioia.aioe.org> <nnd$100bb0b5$745f63e2@4ef6be08da480aa9>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="1b825525f395ae7931c686911d6726ac";
logging-data="1590085"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184+6mmRrBBGrkMz7/x6OFn"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:GRm5JPPAf1xdqSDYqZSUyZkvLIU=
sha1:EBipL01EqeUhGw+lohQKXxi/ZbE=
 by: Paul Rubin - Thu, 3 Nov 2022 16:51 UTC

> This is about as bad at it gets (decompiled, not formatted):
> : FORGET-VOC 2DUP SWAP U< IF SWAP >R >WID BEGIN DUP DUP BEGIN >LFA @
> DUP R@ U< UNTIL SWAP >LFA ! >LFA @ DUP 0= UNTIL DROP R> ELSE >VFA @
> VOC-LINK ! ONLY FORTH DEFINITIONS THEN ;

I had to guess at the stack effects of the internal words and have no
idea what the parameters are supposed to mean, but this looks roughly
like:

: FORGET-VOC { a b }
b a u< IF
b >WID
BEGIN
BEGIN b >LFA @ { c } c a U< UNTIL
b >LFA !
b 0= UNTIL
b c a
ELSE
a b >VFA @
VOC-LINK ! ONLY FORTH DEFINITIONS
THEN ;

Actually that is probably wrong since there is a different amount of
stuff on the stack depending on which branch of the IF is taken.
Some comments and stack diagrams would surely help.

Re: Another example of factoring and locals

<7058e22f-6251-4095-ada6-972e279e7584n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:122a:b0:6fa:729c:2cf1 with SMTP id v10-20020a05620a122a00b006fa729c2cf1mr4702596qkj.338.1667500914062;
Thu, 03 Nov 2022 11:41:54 -0700 (PDT)
X-Received: by 2002:a05:6902:138b:b0:64f:cb1c:9eac with SMTP id
x11-20020a056902138b00b0064fcb1c9eacmr31727716ybu.457.1667500913786; Thu, 03
Nov 2022 11:41:53 -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: Thu, 3 Nov 2022 11:41:53 -0700 (PDT)
In-Reply-To: <5a98a33e-8eed-402a-92d5-183705a7f1d4n@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>
<87a65c66u4.fsf@nightsong.com> <b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org> <19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org> <5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7058e22f-6251-4095-ada6-972e279e7584n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Thu, 03 Nov 2022 18:41:54 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4997
 by: Hans Bezemer - Thu, 3 Nov 2022 18:41 UTC

On Thursday, November 3, 2022 at 11:40:10 AM UTC+1, Doug Hoffman wrote:
> As am I and I believe everyone else I've seen use the return stack
> to stash data stack items.
That's only half the story. I learned this trick from the guy who wrote the FIG
editor - you don't randomly place stuff there, you place the stuff that is either
constant or almost constant.

So - you triage your parameters. Those who change a LOT go on the
data stack and those who (barely) change go on the return stack.
In 4tH, you have R@, R'@ and R"@. And then it starts to make even MORE
sense. You can also map those with I, I' and J - with NO overhead.

The TORS contains the stuff that barely changes., while R'@ and R"@ are
pure constants.

> Did I say that all colon definitions I write use locals?
CONCAT didn't - I loved it. You see, you are perfectly capable to do better ;-)

I understand the sentiment about "throwing away the experience". Forth
not only made me a better programmer, it also forced me to delve deeper
in an algorithm in order to REALLY understand it. LOCALs allow a much
shallower way of implementing it. It also allows me to waste resources -
simply because I can away with it.

If you'd asked me 10 - 20 years ago to make a preprocessor that exceeds
M4 I wouldn't have known where to begin. In Forth, it grew organically. And
at some moment I thought "Wow, did I really make this?"

I also wrote what must be one of the smallest DBMSes (400 lines or so). Again,
a task so daunting in any other languages I probably never would have attempted.

And all this because every single element is forced to be so small, it seems
almost trivial. And all there is is the flow of data through the stack. Every tiny
mistake is punished by a crash. That will teach you discipline.

There is no such mechanism at work when using locals. All words are brute
connected by an interface that is the stack frame. And instead of flowing
almost invisibly through the program there is this point where data becomes
painfully explicit - like C.

It is not a matter of passing parameters in a different way, it's a way of thinking
that is radically different. It is that that newbies fail to comprehend - and often
even fail to master. That's why they drop out.

IMHO it isn't a different way to pass and handle data, it is a different and way of
thinking and designing. And LOCALs aren't about "making things easier", but
a concession to make things workable for lesser gods and sloppy programmers.

I have a lib that does LOCALs - but I never use it. I have embraced this other
way of approaching the problem - and it works for me. I don't see any use in
dropping it (and yes, at times I wrestle with the stack as well) and trade it for
an IMHO inferior way of converting an idea into working code.

Hans Bezemer

Re: Another example of factoring and locals

<12f909f7-02f8-4af5-9516-0aa9620217a7n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:17a5:b0:6ee:9c6a:208d with SMTP id ay37-20020a05620a17a500b006ee9c6a208dmr24366876qkb.337.1667514862416;
Thu, 03 Nov 2022 15:34:22 -0700 (PDT)
X-Received: by 2002:a0d:d74d:0:b0:36b:7256:9355 with SMTP id
z74-20020a0dd74d000000b0036b72569355mr31551764ywd.61.1667514862222; Thu, 03
Nov 2022 15:34:22 -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: Thu, 3 Nov 2022 15:34:22 -0700 (PDT)
In-Reply-To: <7058e22f-6251-4095-ada6-972e279e7584n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:b84d:9ea0:1352:78d4;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:b84d:9ea0:1352:78d4
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>
<87a65c66u4.fsf@nightsong.com> <b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org> <19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org> <5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
<7058e22f-6251-4095-ada6-972e279e7584n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <12f909f7-02f8-4af5-9516-0aa9620217a7n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Thu, 03 Nov 2022 22:34:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2647
 by: Marcel Hendrix - Thu, 3 Nov 2022 22:34 UTC

On Thursday, November 3, 2022 at 7:41:55 PM UTC+1, the.bee...@gmail.com wrote:
[..]
> and trade it for an IMHO inferior way of converting an idea into working code.

It was demonstrated to you (e.g., by Peter Fälth) that it doesn't matter
how you write the Forth source, it converts to the same code, given a
reasonable compiler.

-marcel

Re: Another example of factoring and locals

<7b7ff68d-3dce-42a7-9b30-98072232b4b1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:6998:0:b0:3a5:410a:1a33 with SMTP id o24-20020ac86998000000b003a5410a1a33mr12508839qtq.337.1667518936020;
Thu, 03 Nov 2022 16:42:16 -0700 (PDT)
X-Received: by 2002:a25:4a41:0:b0:6cb:dfc2:8856 with SMTP id
x62-20020a254a41000000b006cbdfc28856mr30683055yba.635.1667518935826; Thu, 03
Nov 2022 16:42:15 -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: Thu, 3 Nov 2022 16:42:15 -0700 (PDT)
In-Reply-To: <12f909f7-02f8-4af5-9516-0aa9620217a7n@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>
<87a65c66u4.fsf@nightsong.com> <b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org> <19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org> <5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
<7058e22f-6251-4095-ada6-972e279e7584n@googlegroups.com> <12f909f7-02f8-4af5-9516-0aa9620217a7n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7b7ff68d-3dce-42a7-9b30-98072232b4b1n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: the.beez...@gmail.com (Hans Bezemer)
Injection-Date: Thu, 03 Nov 2022 23:42:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2897
 by: Hans Bezemer - Thu, 3 Nov 2022 23:42 UTC

On Thursday, November 3, 2022 at 11:34:23 PM UTC+1, Marcel Hendrix wrote:
> On Thursday, November 3, 2022 at 7:41:55 PM UTC+1, the.bee...@gmail.com wrote:
> [..]
If you're talking about a mechanical proces like code generation
You're missing the entire point I'm trying to make.

Hans Bezemer
> > and trade it for an IMHO inferior way of converting an idea into working code.
> It was demonstrated to you (e.g., by Peter Fälth) that it doesn't matter
> how you write the Forth source, it converts to the same code, given a
> reasonable compiler.
>
> -marcel

Re: Another example of factoring and locals

<tk1lin$1ig3$1@gioia.aioe.org>

  copy mid

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

  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: Fri, 4 Nov 2022 11:15:18 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tk1lin$1ig3$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<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>
<87a65c66u4.fsf@nightsong.com>
<b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org>
<19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org>
<5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
<7058e22f-6251-4095-ada6-972e279e7584n@googlegroups.com>
<12f909f7-02f8-4af5-9516-0aa9620217a7n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="51715"; 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 - Fri, 4 Nov 2022 00:15 UTC

On 4/11/2022 9:34 am, Marcel Hendrix wrote:
> On Thursday, November 3, 2022 at 7:41:55 PM UTC+1, the.bee...@gmail.com wrote:
> [..]
>> and trade it for an IMHO inferior way of converting an idea into working code.
>
> It was demonstrated to you (e.g., by Peter Fälth) that it doesn't matter
> how you write the Forth source, it converts to the same code, given a
> reasonable compiler.

So now one is dependent on "a reasonable compiler". GCC here we come.

Re: Another example of factoring and locals

<87y1sr35ra.fsf@nightsong.com>

  copy mid

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

  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: Thu, 03 Nov 2022 17:47:21 -0700
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <87y1sr35ra.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<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>
<87a65c66u4.fsf@nightsong.com>
<b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org>
<19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org>
<5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
<7058e22f-6251-4095-ada6-972e279e7584n@googlegroups.com>
<12f909f7-02f8-4af5-9516-0aa9620217a7n@googlegroups.com>
<tk1lin$1ig3$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="0461ae35af174ede71c441fa410727a9";
logging-data="1666534"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8lCtGz2F+BLbDK9z4EioH"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:Sfq8RkOKPBC/lyGRTWzPFP1mKf4=
sha1:MgR4YsCJmyHP+bBWJYVaO1b9ZQs=
 by: Paul Rubin - Fri, 4 Nov 2022 00:47 UTC

dxforth <dxforth@gmail.com> writes:
> So now one is dependent on "a reasonable compiler". GCC here we come.

You don't have to depend on a compiler at all, but without one, you're
running interpreted Forth which is maybe 10x slower. That 10x is not
too bad, compared to the 50x or more slowdown you get from Python. With
a rudimentary compiler you might get 3x instead of 10x.

Maybe coding style (locals or whatever) can change the 10x to 15x or
vice versa. If you care about that, using a compiler sounds like a
better way to recover the missed speed than warping your mind trying to
optimize interpreted code at the source level. And as usual, if you
have to optimize at all, it is likely to just be in a few hot spots of
the program.

Remember too that even an almost minimal Forth target these days
(Raspberry Pi Pico) is probably 100x faster than the 16 bit
minicomputers where Forth originated. That gives you a lot of breathing
space. There is no need for 3+length dictionaries any more, and we
can also use more relaxed and expressive coding styles.

Re: Another example of factoring and locals

<tk26jf$h8o$1@gioia.aioe.org>

  copy mid

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

  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: Fri, 4 Nov 2022 16:05:51 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tk26jf$h8o$1@gioia.aioe.org>
References: <2022Oct26.225153@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>
<87a65c66u4.fsf@nightsong.com>
<b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org>
<19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org>
<5a98a33e-8eed-402a-92d5-183705a7f1d4n@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="17688"; 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 - Fri, 4 Nov 2022 05:05 UTC

On 3/11/2022 9:40 pm, Doug Hoffman wrote:
> On Tuesday, November 1, 2022 at 10:23:07 AM UTC-4, dxforth wrote:
>> ...
>> If Forth is inadequate it would mean I've wasted 40 years on
>> a bum steer. Locals users too.
>
> I don't follow that logic. How could the way I, or anyone else,
> use Forth impact whether or not you have wasted your time?

How else to describe a language that folks say they can't use unless
locals are added.

Re: Another example of factoring and locals

<87leor2s9i.fsf@nightsong.com>

  copy mid

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

  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: Thu, 03 Nov 2022 22:38:49 -0700
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <87leor2s9i.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<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>
<87a65c66u4.fsf@nightsong.com>
<b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org>
<19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org>
<5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
<tk26jf$h8o$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="0461ae35af174ede71c441fa410727a9";
logging-data="1798560"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cm4B4kG/Qetv0YhjHZx/z"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:43XUSKdaXMlefC9ea2DQVUuJASg=
sha1:q0aFOTx8cdHfD+kPJkNT+KqIfhQ=
 by: Paul Rubin - Fri, 4 Nov 2022 05:38 UTC

dxforth <dxforth@gmail.com> writes:
> How else to describe a language that folks say they can't use unless
> locals are added.

No software is ever finished until its last user is dead. So all
software is inadequate in one way or another. We do what we can in
order to get by anyway.

Re: Another example of factoring and locals

<b13aac86-d358-4cfa-b838-5f74bfd63956n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:688b:0:b0:3a5:4032:84 with SMTP id m11-20020ac8688b000000b003a540320084mr13948999qtq.594.1667544395443;
Thu, 03 Nov 2022 23:46:35 -0700 (PDT)
X-Received: by 2002:a05:6902:1509:b0:6ca:9a5f:7c4 with SMTP id
q9-20020a056902150900b006ca9a5f07c4mr34295006ybu.81.1667544395193; Thu, 03
Nov 2022 23:46:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.uzoreto.com!npeer.as286.net!npeer-ng0.as286.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.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: Thu, 3 Nov 2022 23:46:34 -0700 (PDT)
In-Reply-To: <12f909f7-02f8-4af5-9516-0aa9620217a7n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=95.252.27.40; posting-account=ryzhhAoAAAAIqf1uqmG9E4uP1Bagd-k2
NNTP-Posting-Host: 95.252.27.40
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>
<87a65c66u4.fsf@nightsong.com> <b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org> <19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org> <5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
<7058e22f-6251-4095-ada6-972e279e7584n@googlegroups.com> <12f909f7-02f8-4af5-9516-0aa9620217a7n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b13aac86-d358-4cfa-b838-5f74bfd63956n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: peter.m....@gmail.com (P Falth)
Injection-Date: Fri, 04 Nov 2022 06:46:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4253
 by: P Falth - Fri, 4 Nov 2022 06:46 UTC

On Thursday, 3 November 2022 at 23:34:23 UTC+1, Marcel Hendrix wrote:
> On Thursday, November 3, 2022 at 7:41:55 PM UTC+1, the.bee...@gmail.com wrote:
> [..]
> > and trade it for an IMHO inferior way of converting an idea into working code.
> It was demonstrated to you (e.g., by Peter Fälth) that it doesn't matter
> how you write the Forth source, it converts to the same code, given a
> reasonable compiler.
>
> -marcel

But only if you have the right example code to compile!
In this case my code generator produces the same result with locals or without.
When you have a break in a basic block ( a call, a controlflow point) the locals
needs to be placed in a known place, in the case of lxf the return stack.
This generates extra code.
The problem is the way locals are specified, they have a scope of the whole
word, they are released just at the end of the definition.
Stack parameters have instead a dynamic scope, they are duped, or droped or
consumed as arguments to a word as decided by the programmer.

Of course a multipass compiler could determine the scope of each local and
improve the code generation. Lxf is just a simple 1 pass compiler. The reason
you can make code generation for locals look good with lxf is that they are
implementedto rest on the return stack. I put in some effort to get a good
code generation for the R-stack use. The locals was for free after that.

In my own Forth programming I do not use locals. I have not seen the need
for them and I do not like the way they are specified to look like a comment!
In lxf I have instead another feature n LBUFFER: <name> that reserves n
byte on the return stack that can be accessed with ! @ at <name>. Just like a
variable. This is useful to pass structures to systems call for example.

Best Regards
Peter

Re: Another example of factoring and locals

<tk2fp3$185b$1@gioia.aioe.org>

  copy mid

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

  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: Fri, 4 Nov 2022 18:42:27 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tk2fp3$185b$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<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>
<87a65c66u4.fsf@nightsong.com>
<b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org>
<19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org>
<5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
<tk26jf$h8o$1@gioia.aioe.org> <87leor2s9i.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="41131"; 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 - Fri, 4 Nov 2022 07:42 UTC

On 4/11/2022 4:38 pm, Paul Rubin wrote:
> dxforth <dxforth@gmail.com> writes:
>> How else to describe a language that folks say they can't use unless
>> locals are added.
>
> No software is ever finished until its last user is dead. So all
> software is inadequate in one way or another. We do what we can in
> order to get by anyway.

Oh, I'd say organized Forth is absolutely dead. I agree with your
last line.

Re: Another example of factoring and locals

<ba76eef5-068d-4522-9602-6709540c5076n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:4310:b0:6ac:f9df:178d with SMTP id u16-20020a05620a431000b006acf9df178dmr25497909qko.773.1667550434045;
Fri, 04 Nov 2022 01:27:14 -0700 (PDT)
X-Received: by 2002:a25:aba9:0:b0:6c9:eb26:b782 with SMTP id
v38-20020a25aba9000000b006c9eb26b782mr33752402ybi.166.1667550433891; Fri, 04
Nov 2022 01:27:13 -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: Fri, 4 Nov 2022 01:27:13 -0700 (PDT)
In-Reply-To: <b13aac86-d358-4cfa-b838-5f74bfd63956n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f14:6b1e:d158:3170:da0b:203a;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f14:6b1e:d158:3170:da0b:203a
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>
<87a65c66u4.fsf@nightsong.com> <b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org> <19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org> <5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
<7058e22f-6251-4095-ada6-972e279e7584n@googlegroups.com> <12f909f7-02f8-4af5-9516-0aa9620217a7n@googlegroups.com>
<b13aac86-d358-4cfa-b838-5f74bfd63956n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ba76eef5-068d-4522-9602-6709540c5076n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Fri, 04 Nov 2022 08:27:14 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4130
 by: minf...@arcor.de - Fri, 4 Nov 2022 08:27 UTC

P Falth schrieb am Freitag, 4. November 2022 um 07:46:36 UTC+1:
> In my own Forth programming I do not use locals. I have not seen the need
> for them and I do not like the way they are specified to look like a comment!
> In lxf I have instead another feature n LBUFFER: <name> that reserves n
> byte on the return stack that can be accessed with ! @ at <name>. Just like a
> variable. This is useful to pass structures to systems call for example.

These are good points:
a) when there is no need, then there is no use case
b) standard Forth locals syntax looks strange
c) standard Forth locals are too limited, practical applications often have to deal
with data objects like structures and (dynamic) strings/arrays; at least fp-locals
should be there

As long as one does only "scratch on the ground" i.e. can solve one's task with
some standard words and only integer addresses and numbers as arguments,
locals wouldn't pay their rent.

I am old school myseld, and by myself I use a lot of paper and pencil to understand/tune
data structures and algorithms before I fire up the computer. Then I am rather sure
to have got the thinking right and am happy to leave as much bit&byte lifting as possible
to the compiler. It is a waste of programmer's time to burden him with syntax mistakes.

Whether manual deep factoring is good programming or not, is a matter of personal
likes and experience. Moore and his acolytes live with their experience. There
are good cases where deep factoring works, there are many cases where deep
factoring would break data flows and algorithms apart. Always keep in mind that
code needs to stay maintainable, particularly when you work in a team, and it
must not require solving jigsaw code puzzles.

Re: Another example of factoring and locals

<nnd$5d7f2959$782e4f2d@eb752588fdd3fd66>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Re: Another example of factoring and locals
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjvdqh$3vo$1@gioia.aioe.org> <nnd$100bb0b5$745f63e2@4ef6be08da480aa9> <87tu3gc77i.fsf@nightsong.com>
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$5d7f2959$782e4f2d@eb752588fdd3fd66>
Organization: KPN B.V.
Date: Fri, 04 Nov 2022 11:47:46 +0100
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe006.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 54
Injection-Date: Fri, 04 Nov 2022 11:47:46 +0100
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2609
 by: none - Fri, 4 Nov 2022 10:47 UTC

In article <87tu3gc77i.fsf@nightsong.com>,
Paul Rubin <no.email@nospam.invalid> wrote:
>> This is about as bad at it gets (decompiled, not formatted):
>> : FORGET-VOC 2DUP SWAP U< IF SWAP >R >WID BEGIN DUP DUP BEGIN >LFA @
>> DUP R@ U< UNTIL SWAP >LFA ! >LFA @ DUP 0= UNTIL DROP R> ELSE >VFA @
>> VOC-LINK ! ONLY FORTH DEFINITIONS THEN ;
>
>I had to guess at the stack effects of the internal words and have no
>idea what the parameters are supposed to mean, but this looks roughly
>like:
>
> : FORGET-VOC { a b }
> b a u< IF
> b >WID
> BEGIN
> BEGIN b >LFA @ { c } c a U< UNTIL
> b >LFA !
> b 0= UNTIL
> b c a
> ELSE
> a b >VFA @
> VOC-LINK ! ONLY FORTH DEFINITIONS
> THEN ;
>
>Actually that is probably wrong since there is a different amount of
>stuff on the stack depending on which branch of the IF is taken.
>Some comments and stack diagrams would surely help.

It was not intended to be analysed, but to show how approximately
the most complicated words look. Probably the decompiler had
the control structures wrong hence the return stack imbalance.
In actual source code it look (first part shown).

_HEADER({FORGET-VOC},{FORGV},{DOCOL})
DC TDUP
DC SWAP
DC ULESS
_0BRANCH(FORGV1)
_C{ Forget part of contents.}
DC SWAP
DC TOR
DC TWID
FORGV0:
....

Remember the kernel is code in assembler.

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

Re: Another example of factoring and locals

<a4263bf1-ebb7-4518-9fca-6a4ecdd6f8c6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:15c7:b0:39b:2791:cd44 with SMTP id d7-20020a05622a15c700b0039b2791cd44mr30504386qty.676.1667600178965;
Fri, 04 Nov 2022 15:16:18 -0700 (PDT)
X-Received: by 2002:a25:ef05:0:b0:6cb:b60a:174c with SMTP id
g5-20020a25ef05000000b006cbb60a174cmr35669506ybd.308.1667600178812; Fri, 04
Nov 2022 15:16:18 -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: Fri, 4 Nov 2022 15:16:18 -0700 (PDT)
In-Reply-To: <874jvgfyc9.fsf@nightsong.com>
Injection-Info: google-groups.googlegroups.com; posting-host=84.92.96.37; posting-account=xy4V0QkAAAAoGgkMsSsv6bfFPHkQXvOY
NNTP-Posting-Host: 84.92.96.37
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>
<tji5tj$13t5$1@gioia.aioe.org> <87wn8d0z9g.fsf@nightsong.com>
<tjva23$120s$1@gioia.aioe.org> <87cza4g1do.fsf@nightsong.com>
<tjvevs$cva$1@gioia.aioe.org> <874jvgfyc9.fsf@nightsong.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a4263bf1-ebb7-4518-9fca-6a4ecdd6f8c6n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: jkn...@nicorp.f9.co.uk (Jon Nicoll)
Injection-Date: Fri, 04 Nov 2022 22:16:18 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3007
 by: Jon Nicoll - Fri, 4 Nov 2022 22:16 UTC

On Thursday, November 3, 2022 at 4:36:56 AM UTC, Paul Rubin wrote:
> dxforth <dxf...@gmail.com> writes:
> > AFAIK optimizers do a better job when the code presented is already optimal.
> These days optimizers work by first splitting everything out into
> separate variables so that nothing is ever updated (static single
> assignment or SSA form), and then recombining the variables. I have
> never implemented SSA and don't understand it perfectly, but I believe
> the SSA forms of the 4-local and 6-local versions of that code would be
> very similar. Anton would know this much better than I do.
> >> Well, Moore used VARIABLEs instead of locals,
> > Does he?
>
> I believe so. I remember looking at cmforth and some of the GA144 code
> and seeing variables used that way. I also remember asking Elizabeth
> about the complex multiplication example, and her replying that Moore
> didn't hesitate to use CODE if it made things easier. He wasn't a
> purist about staying with Forth words.
>
> In the 1970s there just wasn't room for purity in software. Maybe APL
> came closest. Lisp was born from the most purest mathematical
> abstraction (lambda calculus) but its implementations were full of low
> level hackery. The purest language now is Haskell but it is also full
> of hacks.

I have wondered about that myself - hacks in the implementation of
'pure' languages. Thanks for these snippets.

Re: Another example of factoring and locals

<tk488c$l17$1@gioia.aioe.org>

  copy mid

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

  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: Sat, 5 Nov 2022 10:46:20 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tk488c$l17$1@gioia.aioe.org>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<tjvdqh$3vo$1@gioia.aioe.org> <nnd$100bb0b5$745f63e2@4ef6be08da480aa9>
<87tu3gc77i.fsf@nightsong.com> <nnd$5d7f2959$782e4f2d@eb752588fdd3fd66>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="21543"; 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 - Fri, 4 Nov 2022 23:46 UTC

On 4/11/2022 9:47 pm, albert wrote:
> In article <87tu3gc77i.fsf@nightsong.com>,
> Paul Rubin <no.email@nospam.invalid> wrote:
>>> This is about as bad at it gets (decompiled, not formatted):
>>> : FORGET-VOC 2DUP SWAP U< IF SWAP >R >WID BEGIN DUP DUP BEGIN >LFA @
>>> DUP R@ U< UNTIL SWAP >LFA ! >LFA @ DUP 0= UNTIL DROP R> ELSE >VFA @
>>> VOC-LINK ! ONLY FORTH DEFINITIONS THEN ;
>>
>> I had to guess at the stack effects of the internal words and have no
>> idea what the parameters are supposed to mean, but this looks roughly
>> like:
>>
>> : FORGET-VOC { a b }
>> b a u< IF
>> b >WID
>> BEGIN
>> BEGIN b >LFA @ { c } c a U< UNTIL
>> b >LFA !
>> b 0= UNTIL
>> b c a
>> ELSE
>> a b >VFA @
>> VOC-LINK ! ONLY FORTH DEFINITIONS
>> THEN ;
>>
>> Actually that is probably wrong since there is a different amount of
>> stuff on the stack depending on which branch of the IF is taken.
>> Some comments and stack diagrams would surely help.
>
> It was not intended to be analysed, but to show how approximately
> the most complicated words look.

Fig-Forth's FORGET was simple but it broke once vocabs were added.
Consequently the code to trim dictionaries back to a usable state
became ever more complicated as dictionaries became more complicated.
Whether it was worth it is debatable but that's how it evolved.
This is for a single-thread, split dictionary with separated headers:

: (forget) ( nfa dps dp -- )
dp 2! >r \ starting maximums
voc-link begin \ trim vocs > nfa
@ dup cell- @ cell+ \ vocab nfa
r@ u<
until dup voc-link !
begin
dup cell- @ \ scan remaining vocs
dup h@ begin
dup r@ u< 0= \ for each word >= nfa
while
-alias if \ not an alias
dup name> \ get its xt
xdp tuck @
umin swap ! \ trim dict
then
n>name
repeat
swap h!
@ ?dup 0= \ until all vocs done
until
r> dup dph !
(idph) @ u< if \ below fence?
protect \ fix bootup values
then
prunes ; \ run prunes list

: EMPTY ( -- )
forth definitions (idph) @ (idp) 2@ (forget) ;

: FORGET ( "name" -- )
get-current context ! name? -alias 0= abort" is alias"
swap limit over u< if dp @ else dps @ swap then (forget) ;

Re: Another example of factoring and locals

<tk4dg8$8kj$1@gioia.aioe.org>

  copy mid

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

  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: Sat, 5 Nov 2022 12:15:51 +1100
Organization: Aioe.org NNTP Server
Message-ID: <tk4dg8$8kj$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> <tji5tj$13t5$1@gioia.aioe.org>
<87wn8d0z9g.fsf@nightsong.com> <tjva23$120s$1@gioia.aioe.org>
<87cza4g1do.fsf@nightsong.com> <tjvevs$cva$1@gioia.aioe.org>
<874jvgfyc9.fsf@nightsong.com> <tjvjju$1h3j$1@gioia.aioe.org>
<cc678ca2-49bc-4b21-b7c5-c49391d0a408n@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="8851"; 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 - Sat, 5 Nov 2022 01:15 UTC

On 4/11/2022 12:06 am, minf...@arcor.de wrote:
> dxforth schrieb am Donnerstag, 3. November 2022 um 06:29:37 UTC+1:
>> My interest is in discovering whether Moore's system works.
>
> Did it work for himself? I gathered that he changed it all the time.

Not the basics AFAIK. No mega-compiler, no locals, no creeping complexity.
It was those who came after that did all that for one reason or another.

Re: Another example of factoring and locals

<0df8eeb1-f0c0-440f-bfeb-c47d9aca8043n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:57d3:0:b0:3a5:4093:8e99 with SMTP id w19-20020ac857d3000000b003a540938e99mr16551331qta.537.1667615922645;
Fri, 04 Nov 2022 19:38:42 -0700 (PDT)
X-Received: by 2002:a81:ad24:0:b0:373:5d91:99fd with SMTP id
l36-20020a81ad24000000b003735d9199fdmr15376559ywh.166.1667615922384; Fri, 04
Nov 2022 19:38:42 -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: Fri, 4 Nov 2022 19:38:42 -0700 (PDT)
In-Reply-To: <tk488c$l17$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:3f7a:20d0:c70:5d26:3f59:dda3;
posting-account=V5nGoQoAAAC_P2U0qnxm2kC0s1jNJXJa
NNTP-Posting-Host: 2600:1700:3f7a:20d0:c70:5d26:3f59:dda3
References: <2022Oct26.225153@mips.complang.tuwien.ac.at> <tjvdqh$3vo$1@gioia.aioe.org>
<nnd$100bb0b5$745f63e2@4ef6be08da480aa9> <87tu3gc77i.fsf@nightsong.com>
<nnd$5d7f2959$782e4f2d@eb752588fdd3fd66> <tk488c$l17$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0df8eeb1-f0c0-440f-bfeb-c47d9aca8043n@googlegroups.com>
Subject: Re: Another example of factoring and locals
From: sdwjac...@gmail.com (S Jack)
Injection-Date: Sat, 05 Nov 2022 02:38:42 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1823
 by: S Jack - Sat, 5 Nov 2022 02:38 UTC

On Friday, November 4, 2022 at 6:46:23 PM UTC-5, dxforth wrote:

> Fig-Forth's FORGET was simple but it broke once vocabs were added.

Using Fig and oldest simple vocabularies. Upgraded FORGET to update
word lists in all existing vocabularies. Didn't bother to fix any
broken VOC-LINK chain; however, I did fence vocabularies when created.
If some FORGET includes a vocabulary, fence will alert and the chain
can be fixed manually. Never had to; not a problem I expect to deal
with.
--
me

Re: Another example of factoring and locals

<878rkq2h4l.fsf@nightsong.com>

  copy mid

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

  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: Fri, 04 Nov 2022 20:51:38 -0700
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <878rkq2h4l.fsf@nightsong.com>
References: <2022Oct26.225153@mips.complang.tuwien.ac.at>
<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>
<87a65c66u4.fsf@nightsong.com>
<b6d6f67e-d25d-4605-a480-c3c109426092n@googlegroups.com>
<tjq4rc$1h03$1@gioia.aioe.org>
<19093cee-3054-48ed-8d4a-92c97806589cn@googlegroups.com>
<tjra46$gid$1@gioia.aioe.org>
<5a98a33e-8eed-402a-92d5-183705a7f1d4n@googlegroups.com>
<tk26jf$h8o$1@gioia.aioe.org> <87leor2s9i.fsf@nightsong.com>
<tk2fp3$185b$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="038bd61b076a05039636db3f1cf94d83";
logging-data="2391902"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/c0K8ZaSa4cjDl3fEAUDoy"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:m/86KqVjSQbA+YVZot17DuPu4ME=
sha1:mGZxFeJzxKLHrrAG1MUMevy0AGY=
 by: Paul Rubin - Sat, 5 Nov 2022 03:51 UTC

dxforth <dxforth@gmail.com> writes:
> Oh, I'd say organized Forth is absolutely dead. I agree with your
> last line.

Well, what was organized Forth trying to do when it was alive? Was it
trying to crank out working code by hook or by crook, or was it trying
to pursue a vision of stack combinator purity? If it was merely trying
to crank out code, I still think locals help with that, and haven't seen
persuasive reasoning to the contrary. If it was trying to pursue purity
then obviously locals are a no-no, ok fine. It may make me a philistine
but I don't think the vision has held up that well. Lambda calculus has
held up a lot better.

In Ting's writings I see both approaches. In Jeff Fox's, I can't always
tell what he is getting at. And Moore sometimes seems to be operating
in a different world than the rest of us.


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

Pages:123456789
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor