[parenscript-devel] What about (declare (special foo))?

Daniel Gackle danielgackle at gmail.com
Thu Dec 31 02:36:36 UTC 2009


PS supports special variables but to use them requires declaring a variable
with DEFVAR instead of VAR. I'm not fond of this because the DEFVAR-vs.-VAR
distinction in PS doesn't fit with the DEFVAR-vs.-DEFPARAMETER distinction
in CL (at least, I don't see the analogy if there is one).

What I'd like is to be able to do this:

(ps (let ((*foo* 123))
            (declare (special *foo*))
            (blah)))
=>
"var FOO12733 = FOO;
try {
    FOO = 123;
    blah();
} finally {
    FOO = FOO12733;
};"

Vladimir, do you think this would be hard to do? It's similar to how LET
works on variables declared with DEFVAR. The difference of course is that
here *FOO* stops being a special-variable when the DECLARE goes out of
scope.

Do you (or does anyone) think that the above would be a bad idea? If so,
why?

We have a macro right now that does the above in a somewhat ugly way, and
it's very handy on the 3 or 4 occasions that we need it.

Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20091230/417338a0/attachment.html>


More information about the parenscript-devel mailing list