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: Re: Elisp lexical-let Date: Thu, 23 Jul 2009 19:05:46 +0200 Message-ID: <4A68986A.20006@domob.eu> References: <4A661B73.4090706@domob.eu> <4A66D7BF.5060606@domob.eu> <4A670D78.3040804@gentoo.org> <4A67676F.9010905@domob.eu> <4A6880AE.9070600@gentoo.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1248368783 15330 80.91.229.12 (23 Jul 2009 17:06:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jul 2009 17:06:23 +0000 (UTC) Cc: Andy Wingo , Ken Raeburn , guile-devel , Neil Jerram To: "Marijn Schouten (hkBst)" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jul 23 19:06:15 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 1MU1kF-0006Mx-3U for guile-devel@m.gmane.org; Thu, 23 Jul 2009 19:06:15 +0200 Original-Received: from localhost ([127.0.0.1]:48909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MU1kE-0001a7-KC for guile-devel@m.gmane.org; Thu, 23 Jul 2009 13:06:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MU1jR-0001MH-7G for guile-devel@gnu.org; Thu, 23 Jul 2009 13:05:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MU1jM-0001KH-6S for guile-devel@gnu.org; Thu, 23 Jul 2009 13:05:24 -0400 Original-Received: from [199.232.76.173] (port=33786 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MU1jL-0001K8-VZ for guile-devel@gnu.org; Thu, 23 Jul 2009 13:05:20 -0400 Original-Received: from tatiana.utanet.at ([213.90.36.46]:45775) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MU1jL-0006qn-G8 for guile-devel@gnu.org; Thu, 23 Jul 2009 13:05:19 -0400 Original-Received: from patricia.xoc.tele2net.at ([213.90.36.9]) by tatiana.utanet.at with esmtp (Exim 4.69) (envelope-from ) id 1MU1jH-0004un-EI; Thu, 23 Jul 2009 19:05:15 +0200 Original-Received: from d86-33-51-42.cust.tele2.at ([86.33.51.42] helo=[192.168.1.18]) by patricia.xoc.tele2net.at with esmtpa (Exim 4.69) (envelope-from ) id 1MU1jH-0003I2-AD; Thu, 23 Jul 2009 19:05:15 +0200 User-Agent: Thunderbird 2.0.0.0 (X11/20070425) In-Reply-To: <4A6880AE.9070600@gentoo.org> 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:8924 Archived-At: Hi, thanks for your comments; I'm still a bit confused, though :$ Marijn Schouten (hkBst) wrote: >> What's about this: >> >> (defun test () a) >> (let ((a 1)) >> (print a) ; 1 >> (print (test)) ; 1 >> (lexical-set! a 2) > there is only one variable `a' in my mental model, > so this changes the value of the only `a' and all > subsequent expressions accessing `a' are thus affected. > The same as if you had written `(set! a 2)'. Dynamic > and lexical only differ in how free variables in > procedures are bound. >> (print a) ; 1? > no, (print a) => 2 >> (print (test)) ; 1 > no, there is only one `a' and its value is 2 here >> (print (lexical a)) ; 2 >> ) Hm... my problem is trying to understand how you want this implemented; my main point about lexical scoping is that it enables us to use Guile's built-in lexical mechanisms and we don't have to save the value explicitly into some fluids. But if you require that the second (print (test)) above prints 1 even though we have done (lexical-set! a) this means that lexical-set! must update the place somehow where a is accessed dynamically (as is done in test). And that seems to imply that this lexical-set! updates the fluids, even though it is meant to perform on a lexically bound variable a; just in case that "the one" a is at some place referred to dynamically. >> I don't think it's good to have to "completely seperate" variables a and >> (lexical a). > > I don't understand what you mean. My proposal is to have one kind of variable > and two kinds of access. Can you please elaborate on this? If there's only one variable and only the value 2 after the lexical-set! above (both for (print a) in the lexical scope and (print (test)) which accesses a dynamically), what would then be the point of writing 'a' or '(lexical a)' and what would be the difference between those two? Yours, Daniel -- Done: Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz To go: Hea-Kni-Mon-Pri