Skip to content

Instantly share code, notes, and snippets.

@paniq
Created September 2, 2017 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paniq/8dcb2231d4b1ab4857520e527fc747ce to your computer and use it in GitHub Desktop.
Save paniq/8dcb2231d4b1ab4857520e527fc747ce to your computer and use it in GitHub Desktop.
when the entry label to a function is originally declared (during macro expansion),
the entry label is tagged with the label that was active when the label was declared;
this is called the scope label.
later, during evaluation, when an entry label is encountered as argument, and the
label has a scope label tag, the current frame (a cactus stack) is searched upwards
for the scope label, and truncated by that amount.
if the scope label tag can not be found in upwards frames (and this is the part that
gives me grief, because it happens too much) then the current frame is taken as-is.
the closure is then formed from the entry label and the frame.
so, in short: closure is formed from the active frame + label by default, but if we
can truncate the frame, we do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment