2026-07-02 17:32 UTC
Replies (1)
-
@Kazinator@mstdn.ca 2026-07-02 21:02
@psf@oldbytes.space What is that? Are closures just tree structure in muLISP, whereby you can use rplaca to replace some element, like the closed-over environment? Which is just a naive alist? (Why does that need the (quote ...) wrapping). So you made a couple of closures which reference a free variable, and then you injected a shared environment which closes the variable. Whether you can do that in another Lisp depends on whether such a manipulation of its functions is allowed. There may also be multiple representations to deal with: one way to manipulate the environment of a compiled closure vs. interpreted one. I suspect that in compiled Lisps, you may not be able to do it exactly like that. If a closure is compiled whose body refers to a free variable x, the generated code will not be accessing that x through the environment vector: the x references get compiled differently based on its scoping discipline.