On Fri Oct 7 2016 Stefan Monnier wrote:
> The first solution binds the <varN> variables lexically rather than
> dynamically.  That means that if those <varN> appear lexically inside
> the <form> things will work correctly, but if <form> calls a function
> which then refers to <varN> this reference will fail.

Thank you for the clarification.  The code in bbdb-anniv binds the
variables lexcially via let which also contains the call of eval.
So this is fine.

> This note about lexical binding is talking about a chunk of code like
>     (let ((x 1))
>       ...
>       (defvar x 5)
>       ...)
> if run in lexical-binding mode, the let will bind `x` statically, but
> `defvar` always refers to the dynamically-bound variable `x`, just like
> (set 'x 5) would.
> > This suggests to me that in your second approach the defvar's could
> > also go inside the let, which appears rather odd to me.
> No, that wouldn't work: the (defvar <varN>) is there to declare that
> subsequent uses of <varN> should use dynamic scoping.

Again thanks for the clarification.  I'll stay with the first
approach you suggested.


Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to