Bob Rogers wrote:
All I am talking about is the equivalent of what "local $var" provides
for Perl 5, i.e. dynamically-scoped binding of scalar "package
variables."
Perl 5 locals and Perl 6 temps are quite different than Lisp special
variables. I don't immediately see a way to explain this any more
clearly than I explained it last time.
If the problem is simply "implement Common Lisp special variables", then
the most likely solution is to create a LispSpecialVar PMC. In the same
way that a MultiSub acts like a sub but internally stores a list of
subs, the LispSpecialVar would act like an ordinary variable to Parrot
internals and to all other languages, but would internally store a stack
of previous dynamic bindings.
How would continuations capture dynamic bindings, then?
What information do the continuations need to capture? i.e. what do they
need to restore when invoked?
In general, continuations capture globals, but don't capture the values
of the globals. Invoking a continuation doesn't restore the value of a
global.
How would
stack-unwinding know which dynamic bindings to unmake?
A LET has a scope (a beginning and an end), so you generate the binding
code at the beginning and the corresponding unbinding code at the end.
Allison