From: Phillip Lord <p.lord@russet.org.uk>
Subject: Re: Differences between Elisp and Lisp
Date: 29 Apr 2003 16:56:32 +0100 [thread overview]
Message-ID: <vfllxtz49b.fsf@rpc71.cs.man.ac.uk> (raw)
In-Reply-To: sfw3ck1z4vj.fsf@shell01.TheWorld.com
>>>>> "Kent" == Kent M Pitman <pitman@world.std.com> writes:
Kent> Thomas Link <samul@web.de> 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
next prev parent reply other threads:[~2003-04-29 15:56 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.5343.1051607007.21513.help-gnu-emacs@gnu.org>
2003-04-29 10:22 ` Differences between Elisp and Lisp Friedrich Dominicus
2003-04-29 10:27 ` Lars Magne Ingebrigtsen
2003-04-29 10:35 ` David Kastrup
2003-04-29 11:03 ` Oliver Scholz
2003-04-29 12:23 ` Phillip Lord
2003-04-29 14:17 ` Thomas Link
2003-04-29 15:43 ` Kent M Pitman
2003-04-29 15:56 ` Phillip Lord [this message]
2003-04-29 16:44 ` Kent M Pitman
2003-04-29 17:16 ` Phillip Lord
2003-04-29 18:41 ` Kai Großjohann
2003-04-30 12:39 ` Phillip Lord
2003-04-30 13:12 ` Kai Großjohann
2003-04-30 18:07 ` Kevin Rodgers
2003-04-29 18:59 ` Oliver Scholz
2003-04-30 12:43 ` Phillip Lord
2003-04-29 17:01 ` Kai Großjohann
2003-04-30 23:02 ` Stefan Monnier
2003-05-01 5:22 ` Lars Magne Ingebrigtsen
2003-05-01 5:41 ` Friedrich Dominicus
2003-05-01 5:54 ` Lars Magne Ingebrigtsen
2003-05-01 6:37 ` [OT] " Friedrich Dominicus
[not found] ` <yoijznm9y5yr.fsf@bilbo.dd.chalmers.se>
2003-04-29 13:45 ` Kent M Pitman
2003-04-29 15:23 ` Nicolas Neuss
2003-04-29 15:28 ` Nicolas Neuss
2003-04-29 14:23 ` Marco Antoniotti
2003-04-29 14:29 ` Phillip Lord
2003-04-29 19:06 ` Oliver Scholz
2003-04-29 16:51 ` Kaz Kylheku
2003-04-29 8:57 Daniel R. Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vfllxtz49b.fsf@rpc71.cs.man.ac.uk \
--to=p.lord@russet.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.