[pro] couple questions about dynamic bindings

Peter Seibel peter at gigamonkeys.com
Mon Dec 27 16:43:21 UTC 2010


I'm assuming you're surprised by the results of the forms you give
below. The issue isn't that progv makes "a differest special"--it
makes a new binding. So in the first form you've created a new binding
for x with no supplied value so boundp returning NIL seems about
right. And in the second case, you create a binding, assign it a
value, and then leave the scope of the binding. Or I'm missing
something about your question.

-Peter

On Sun, Dec 26, 2010 at 4:04 PM, Greg Gilley <ggilley at gerg.org> wrote:
>
> There are some tests in the common-lisp test suite with dynamic binding that I don't understand. If someone could help shed some light on them I'd appreciate it.
>
> progv makes it's arguments special. I don't understand how they can be a different special than the one declared in the let. I'd love an explanation.
>
> (let ((x 0))
>    (declare (special x))
>    (progv '(x) ()
>      (boundp 'x))) ==> NIL
>
> (let ((x 0))
>    (declare (special x))
>    (progv '(x) () (setq x 1))
>    x) ==> 0
>
> Thanks,
>
>        Greg
>
>
> _______________________________________________
> pro mailing list
> pro at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/pro
>



-- 
Peter Seibel
http://www.codequarterly.com/




More information about the pro mailing list