From mboxrd@z Thu Jan 1 00:00:00 1970
Path: main.gmane.org!not-for-mail
From: Phillip Lord
Newsgroups: gmane.emacs.help
Subject: Re: Differences between Elisp and Lisp
Date: 29 Apr 2003 16:56:32 +0100
Organization: Dept of Computer Science, University of Manchester, U.K.
Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org
Message-ID:
References:
<3eae89b4$0$13158$3b214f66@usenet.univie.ac.at>
NNTP-Posting-Host: main.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: main.gmane.org 1051632458 29978 80.91.224.249 (29 Apr 2003 16:07:38 GMT)
X-Complaints-To: usenet@main.gmane.org
NNTP-Posting-Date: Tue, 29 Apr 2003 16:07:38 +0000 (UTC)
Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 29 18:07:36 2003
Return-path:
Original-Received: from monty-python.gnu.org ([199.232.76.173])
by main.gmane.org with esmtp (Exim 3.35 #1 (Debian))
id 19AXdn-0007nF-00
for ; Tue, 29 Apr 2003 18:07:35 +0200
Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org)
by monty-python.gnu.org with esmtp (Exim 4.10.13)
id 19AXbl-00028j-00
for gnu-help-gnu-emacs@m.gmane.org; Tue, 29 Apr 2003 12:05:29 -0400
Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news-xfer.cox.net!zen.net.uk!130.88.203.18.MISMATCH!peernews.mcc.ac.uk!cs.man.ac.uk!not-for-mail
Original-Newsgroups: gnu.emacs.help
Original-Lines: 51
Original-NNTP-Posting-Host: rpc71.cs.man.ac.uk
Original-X-Trace: wapping.cs.man.ac.uk 1051631792 21864 130.88.198.228 (29 Apr 2003
15:56:32 GMT)
Original-X-Complaints-To: news@wapping.cs.man.ac.uk
Original-NNTP-Posting-Date: Tue, 29 Apr 2003 15:56:32 +0000 (UTC)
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.93
Original-Xref: shelby.stanford.edu gnu.emacs.help:112520
Original-To: help-gnu-emacs@gnu.org
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1b5
Precedence: list
List-Id: Users list for the GNU Emacs text editor
List-Help:
List-Post:
List-Subscribe: ,
List-Archive:
List-Unsubscribe: ,
Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org
Xref: main.gmane.org gmane.emacs.help:9017
X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:9017
>>>>> "Kent" == Kent M Pitman writes:
Kent> Thomas Link writes:
>> > I thought that CL already implemented lexical binding? At least
>> >within a let form (or "lexical-let").
>> I guess it's faking lexical binding by replacing variable names
>> with gensyms. This makes it pseudo-lexical but not more
>> efficient.
Kent> In addition to having questionable efficiency issues, such a
Kent> strategy also eliminates the one primary reason that more than
Kent> anything justifies lexical scoping--the ability to know 'just
Kent> by looking' that no other uses of the variable exist and that
Kent> it's ok to optimize.
Perhaps I am confusing things here, but I always assumed that the
problem with dynamic binding is that it makes odd things happen.
So take...
(defvar x 1)
(defun test()
(let ((x 10))
(test2)
(message "test: %s" x)))
(defun test2()
(setq x 20))
(test)
x
Eval'ing (test) gives "test: 20", and x gives 1.
If you change the let to lexical-let you get
"test:10" and "20". This seems much more intuitive to me. Of course
its useful to be able to "subvert" the setq in test2 to not work on
the main defvar defined x, and I've used this occasionally. But in
general its likely to result in program errors, as the test function
needs to know that none of the functions it use a variable called x.
Optimisation might be an issue as well of course, but processors are
fast these days! Its nice, but not essential.
Cheers
Phil