argumentcomputer / lurk-lisp

Lisp implementation of Lurk.
MIT License
67 stars 6 forks source link

Fix scoping of LETREC* closure extension. #7

Closed porcuquine closed 3 years ago

porcuquine commented 3 years ago

It came to light that LETREC* was exposing later bindings of closures to the bodies of closures bound earlier — effectively behaving like LETREC (at least in this case). That was a bug, and this PR fixes it.

namin commented 3 years ago

BTW, even though this is what you want (and that seems fine), @webyrd just pointed out that it's not the Scheme letrec*: http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_idx_406

"Despite the left-to-right evaluation and assignment order, each binding of a has the entire letrec* expression as its region, making it possible to define mutually recursive procedures."

porcuquine commented 3 years ago

I see. Not mostly being a Schemer, I actually didn't even initially realize there was a Scheme LETREC*. My initial intention was just to distinguish it from the LETREC it clearly wasn't.

Can either of you suggest a better name? I'll think of one if not. I'd rather avoid the confusion introduced by using a name with a well-established meaning different from the one we assign it.

porcuquine commented 3 years ago

How about LETREC-?