From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Kraft Newsgroups: gmane.lisp.guile.devel Subject: Elisp lexical-let Date: Tue, 21 Jul 2009 21:48:03 +0200 Message-ID: <4A661B73.4090706@domob.eu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1248205734 18730 80.91.229.12 (21 Jul 2009 19:48:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jul 2009 19:48:54 +0000 (UTC) Cc: guile-devel To: Ken Raeburn Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jul 21 21:48:47 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MTLKQ-0004jI-Mz for guile-devel@m.gmane.org; Tue, 21 Jul 2009 21:48:47 +0200 Original-Received: from localhost ([127.0.0.1]:35597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTLKQ-0003Vd-94 for guile-devel@m.gmane.org; Tue, 21 Jul 2009 15:48:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTLJN-0002kO-5i for guile-devel@gnu.org; Tue, 21 Jul 2009 15:47:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTLJI-0002iC-LM for guile-devel@gnu.org; Tue, 21 Jul 2009 15:47:40 -0400 Original-Received: from [199.232.76.173] (port=51235 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTLJI-0002i6-9E for guile-devel@gnu.org; Tue, 21 Jul 2009 15:47:36 -0400 Original-Received: from tatiana.utanet.at ([213.90.36.46]:43622) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MTLJH-0003NZ-On for guile-devel@gnu.org; Tue, 21 Jul 2009 15:47:36 -0400 Original-Received: from plenty.xoc.tele2net.at ([213.90.36.8]) by tatiana.utanet.at with esmtp (Exim 4.69) (envelope-from ) id 1MTLJG-0001aL-Hj; Tue, 21 Jul 2009 21:47:34 +0200 Original-Received: from d91-128-23-10.cust.tele2.at ([91.128.23.10] helo=[192.168.1.18]) by plenty.xoc.tele2net.at with esmtpa (Exim 4.69) (envelope-from ) id 1MTLJG-0000OI-Dz; Tue, 21 Jul 2009 21:47:34 +0200 User-Agent: Thunderbird 2.0.0.0 (X11/20070425) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8908 Archived-At: Hi again, I just had some doubts about the details of lexical-let for elisp, which seem to be not answered by the document I linked to... Maybe you can clarify these to me. Especially, the question is about "what happens" when a lexical variable is inside its scope again bound dynamically (say via let or a lambda expression). Like in this example (I'm not sure if all my expected outputs are right, please correct me as needed): (defvar x 1) (defun foo () x) (lexical-let ((x 2)) x ; -> 2 (foo) ; -> 1 (setq x 3) x ; -> 3 (foo) ; -> 1 (let ((x 4)) x ; -> 4? (foo) ; -> 4 (setq x 5) x ; -> 5 (foo) ; -> 5 ) ; end the let x ; -> 3? (foo) ; -> 4 ) x ; -> 4 (foo) ; -> 4 So in this case all references to x in the lexical scope of the let are to the dynamic value again, while the lexical is untouched and restored after leaving the let? Have a nice evening! Daniel -- Done: Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz To go: Hea-Kni-Mon-Pri