In article <uo5ltg$1c7te$
[email protected]>, dxf <
[email protected]> wrote:
On 16/01/2024 7:49 pm, Anton Ertl wrote:
dxf <[email protected]> writes:
On 15/01/2024 7:01 pm, Anton Ertl wrote:
dxf <[email protected]> writes:
Forth has never really tackled resolving arbitrary multiple THENs - >other than
in the limited context of CASE.
Maybe that's why extending CASE has found adoption beyond the original >>>> source, a rarity in the NIH-dominated Forth circles in this century.
...
Supported both in VFX (where it originated) and in Gforth.
Why extend CASE ?
Why not? We already have Eaker's CASE. Each step in extening it adds
useful functionality:
?OF turns CASE into a general conditional control structure.
Forth has IF for that. Adding words to replicate functionality
that already exists is an unnecessary duplication.
NEXT-CASE allows extending that functionality to loops.
Forth has BEGIN AGAIN. No need to duplicate it.
CONTOF (Gforth-only for now) allows implementing loops like those
written with the "do" command of the guarded-command language;
alternatively, one can see it as extending OF/?OF with a looping
variant like NEXT-CASE extended CASE with looping.
Wil Baden maintained Forth's control structures were sufficient.
Sure enough I was able to replicate your CONTOF examples using
regular forth at a similar level of complexity.
I agree with Will.
Anton Ertl had me to reconsider where I used CASE.
Sure enough CASE is obscure, and I detected a long standing
bug in a default case. That would never happen if I
had used IF ELSE THEN .
(The code was original from Marcel Hendrix, and I got confused
converting the code for the default case
DUP ABORT" something wrong"
).
:I OF OVER = IF DROP ;
:I ENDCASE DROP THENS ;
Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring. - the Wise from Antrim -
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)