help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: let-bind a varlist only known at run time


From: Roland Winkler
Subject: Re: let-bind a varlist only known at run time
Date: Sun, 4 Jun 2017 22:08:54 -0500

On Mon Jun 5 2017 Michael Heerdegen wrote:
> FWIW that's what `cl-progv' is doing, more or less.  The body is pasted
> into a lambda constructed before calling eval so that it can be
> compiled.  The resulting semantics can be a bit surprising, though; for
> example
> 
> (let ((x 0))
>   (cl-progv (list 'x) (list 1)
>     (funcall (lambda () x))))
> 
> yields 0 with lexical-binding on, and
> 
> (cl-progv (list 'x) (list 1)
>     (funcall (lambda () x)))
> 
> yields 1.

Thanks, I thought about that:

If var-list is the VARLIST for the let form, you should also use
var-list to construct the alist that becomes the 2nd arg LEXICAL of
eval.  I believe, then it should not matter whether you have lexical
binding on or off (untested!)

So is this a bug in cl-progv?  (I checked: this macro ignores the
2nd arg LEXICAL of eval.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]