[parenscript-devel] Lexical scoping question

Red Daly reddaly at gmail.com
Mon Jun 8 08:30:17 UTC 2009


On Sun, Jun 7, 2009 at 11:46 PM, Vladimir Sedach <vsedach at gmail.com> wrote:

> So basically any form that introduces a lexical binding inside a
> defun/lambda should correspond exactly to CL semantics (if not, it's a
> bug!). Anything that's in the toplevel will either introduce a new
> top-level lexical variable, or change the value of an existing one.
>

I have not tried out the lexical scoping yet, so I cannot be sure how this
works.  Is there a means of declaring variables special?  So if you have

(defvar *g* 1)

(defun foo ()
   (let ((*g* 5))
      (declare (special *g*))
      (print-g)))
   (print-g))

(defun print-g () (print *g*))

It will 51 and not 11 or 55?  I am unsure of the current semantics of
let--whether anything is treated as dynamic and rebound, etc.  Is the manual
up to date?

Best,
Red



>
> I guess one thing that can be done is to wrap any let forms in the
> toplevel into a lambda that's called right then and there. I
> personally don't like the toplevel/non-toplevel dimorphism in the
> generated code so I'm not going to do it unless a compelling reason is
> found.
>
> Vladimir
>
> > Daniel
> >
> > _______________________________________________
> > parenscript-devel mailing list
> > parenscript-devel at common-lisp.net
> > http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
> >
> >
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20090608/537b92bd/attachment.html>


More information about the parenscript-devel mailing list