Liste des Groupes | Revenir à cl forth |
On Sat, 27 Jul 2024 15:35:55 +0000, Anton Ertl wrote:I think, the standard quotation (that is defined via "[: ... ;]") shall return the same xt in different runs in run-time.minforth@gmx.net (minforth) writes:In MF36 quotations already have read/write access to the locals of the[[: ;]] define closures, but unlike gforth's more flexible>
flat closures, they capture simply all upvalues (here local a).
Gforth's flag closures can be considered lower-level (they come out of
implementation ideas in the Scheme community) and are easier to
implement, but emulating closures that capture outer locals is more
cumbersome.
parent function.
So closures became a simple by-product through capturingA related problem is known as the funarg problem [1].
the parent's locals stack and injecting it at startup during closure
runtime. When the closure finishes, the captured stack is simply
updated.
I don't know if this would be good enough for a Lisp/Scheme programmer,
but it works for my needs. And look Ma, no garbage collection. :-)
One other aspect is that in Gforth's closures theIn MF36 it is only the locals stack. AFAIU in other programming
programmer decides whether closures are allocated in the dictionary,
on the locals stack, on the heap, or elsewhere.
languagues there are closures where the parent function can be seen as
constructor. IOW call the parent function twice and you get different
xts/addresses. From this perspective MF36 closures would perhaps only
qualify as 'half-closures'.
Les messages affichés proviennent d'usenet.