From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: let-bind a varlist only known at run time Date: Wed, 12 Jul 2017 23:59:42 +0200 Message-ID: <87h8yhfh9t.fsf@drachen> References: <28921.59572.342625.22836@gargle.gargle.HOWL> <87efuzup10.fsf@drachen> <52038.28949.342810.22836@gargle.gargle.HOWL> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1499896821 23122 195.159.176.226 (12 Jul 2017 22:00:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 12 Jul 2017 22:00:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Roland Winkler Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 13 00:00:17 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 1dVPg5-0005Xl-Lu for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Jul 2017 00:00:13 +0200 Original-Received: from localhost ([::1]:56162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVPg8-0002uN-8n for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Jul 2017 18:00:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVPfk-0002u6-6c for help-gnu-emacs@gnu.org; Wed, 12 Jul 2017 17:59:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVPfg-0004UJ-9R for help-gnu-emacs@gnu.org; Wed, 12 Jul 2017 17:59:52 -0400 Original-Received: from mout.web.de ([212.227.17.11]:53987) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVPff-0004TN-Ui; Wed, 12 Jul 2017 17:59:48 -0400 Original-Received: from drachen.dragon ([88.73.234.235]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MGRVU-1dR1xR2uci-00DDXo; Wed, 12 Jul 2017 23:59:45 +0200 In-Reply-To: <52038.28949.342810.22836@gargle.gargle.HOWL> (Roland Winkler's message of "Sun, 4 Jun 2017 22:08:54 -0500") X-Provags-ID: V03:K0:Cv8zqojSoVPiFOsR8GeHFlNaGjyhCd6H/Rli8f8YJv5dHkuLNaB 1RC6AaizUSW6VpSxTHTEIHgbcu2B0GI3HlwzFSYPDfho2iwlLWHcip/wxRSamPdRbG30GCH YDgofOFY6fZrGBEDrpMTbRgih2jNyFj61LuQmqcqXxanhhG8Po8r0ZE/EAQKc5viGpJqT89 5GMcPSYlQV8olgaYNKmXg== X-UI-Out-Filterresults: notjunk:1;V01:K0:6fKFB/8f2iQ=:zQXhuDOeWX38T447XGyRe+ AbfefdaO6IXek64c4w2OM/5/o1kxj1qGm+d6wwpXRqYARbGvVB/GhDRGOBPQuRDPvs6eemGIz +G6n5pKCx6PWt2OKNWVRDdohIVTVuB+c3YF+/lKUU2PyLF6cPb/7nqsKFIUJENkiXpTKt6ES7 oQD0wQpLIk0K4kjVOtBbEGllVOS8rL18top3jfqlN1ZtVEGiO0knLRgtRsXK3CwTTSkA4toPR oszU8aulMFHJlgAD3NZxcL0gklEsbd4XKvFFJ1H5ET7S0IrQLgM3Hxb+LEbE0zp9YnUb/bBm+ Hi2zBIvsiHuZTfqByndc6Mcxp5iRDOfn7KNFmCig0bj65yTxL2NgKSqNFsmk5s5dIfMbYoz2g Mkfh2ztMmTHb0+vTxNeRhjMbOQ6m3Uu8HcVZwZcUjCZG+R9sc3RmjoJSlWJbprGwVw1cwu7+J z7e2NLSQAxB/Jhj2bBUAK5DViT15NZCTnHReooKPcSNjphZiVcL18l4IiELn54Lauu6NUvtXW KXR98xmwZ5dm/kMMx4Bc5UHk5/M3vN16CWMbJtFTHSHfAS73cQbEj/k6OruspDA+TLmy/yFio +WvQno0Q0uovsOl70NSP+jqLZ28eJ+pjTNjCJijUBz78AbYEPUGuTwFMsu98iI5LLb5UffZLa px3WjI9TWvK94zT7Iip2EIav/a14Hu2Ap9zIQoHFM9pZV39zHnfmagW7U3e2/zd6Rxlvl0sTg +1YQObcy47KAef9jSbzv9F+ABDBpGvBhgg3Z3+6s5U6xiT6PPcVtvkZawkpdYL2HZ/Sr9leu X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.11 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:113760 Archived-At: "Roland Winkler" writes: > > 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!) I don't think it's that simple: BINDS is unevaluated: it's a list of the form ((SYMBOL EXPRESSION) ...). We would need to evaluate the bindings twice (once to calculate the environment for `eval', and the second time when evaluating the constructed form), which is unacceptable. > So is this a bug in cl-progv? (I checked: this macro ignores the > 2nd arg LEXICAL of eval.) I think it's a bug, it's now filed as #27674. Regards, Michael.