Sujet : Re: Back & Forth - Co-routines
De : albert (at) *nospam* spenarnc.xs4all.nl
Groupes : comp.lang.forthDate : 12. Feb 2025, 13:49:48
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$2b2830d3$0b55ca14@2494f4a8cffa58eb>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
87wmdwunwk.fsf@nightsong.com>,
Paul Rubin <
no.email@nospam.invalid> wrote:
minforth@gmx.net (minforth) writes:
Unfortunately, everything is very non-standard, as there is
no multitasking wordset (for historical reasons?).
A pity really, as co-operative multitasking existed very
early on in Forth.
>
I had thought there wasn't enough agreement about the wordset to
standardize it, and the same thing happened for cross development. But
at least for multitasking, there is reasonable shared understanding
about how it should work, at least in the cooperative case.
>
Then it would be easier to have better discussions about coroutines
(the original topic of this thread) or ownership of closure objects
and different variants of GC.
>
I think these fancy closures are mostly of interest to language geeks
and not so much in the old-fashioned Forth spirit. Coroutines don't
seem that important if you have multitasking. Anton's GC is great and I
think cooperative multitasking wouldn't affect it much, if you don't
mind the collection pauses. It would simply block during collection.
Look at python: they have decorators. In Forth this looks like:
' aap ' noot decorate
Execute `aap (e.g. .S) before each invocation of `noot
This works nicely with coroutines. In ciforth it is actually implemented.
(also undecorated of course)
In ciforth the canonical example is
"
{ &i EMIT .S ;: &o EMIT .S } 'somethingbuggy decorated
"
The `;: ( `CO ) takes care that the second part is executed after each
invocation of `somethingbuggy.
Note that this is ideal for Heisenbug's, where you cannot insert testoutput
because the bug disappears as soon as memory is shifted.
Downplaying coroutines is an indication that you have not realised
the potential.
[I don't care much about closures, maybe the same applies to me
about closures.]
Groetjes Albert
-- Temu exploits Christians: (Disclaimer, only 10 apostles)Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style WallArt For Home, Office And Garden Decor - Perfect For Windows, Bars,And Gifts For Friends Family And Colleagues.