From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Roland Winkler" Newsgroups: gmane.emacs.help Subject: Re: let-bind a varlist only known at run time Date: Sun, 4 Jun 2017 22:08:54 -0500 Message-ID: <52038.28949.342810.22836@gargle.gargle.HOWL> References: <28921.59572.342625.22836@gargle.gargle.HOWL> <87efuzup10.fsf@drachen> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1496632202 11662 195.159.176.226 (5 Jun 2017 03:10:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 5 Jun 2017 03:10:02 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Michael Heerdegen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 05 05:09:57 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHiOz-0002Qb-CZ for geh-help-gnu-emacs@m.gmane.org; Mon, 05 Jun 2017 05:09:57 +0200 Original-Received: from localhost ([::1]:59360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHiOz-0006MI-QM for geh-help-gnu-emacs@m.gmane.org; Sun, 04 Jun 2017 23:09:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHiO6-00066x-H1 for help-gnu-emacs@gnu.org; Sun, 04 Jun 2017 23:09:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHiO5-00026s-EZ for help-gnu-emacs@gnu.org; Sun, 04 Jun 2017 23:09:02 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHiO5-00026f-BA; Sun, 04 Jun 2017 23:09:01 -0400 Original-Received: from [2602:30a:2e52:d720:65b7:1416:12e7:8bfb] (port=60396 helo=regnitz) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1dHiO4-0005ei-Ij; Sun, 04 Jun 2017 23:09:01 -0400 In-Reply-To: <87efuzup10.fsf@drachen> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113357 Archived-At: 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.)