From: "Marijn Schouten (hkBst)" <hkBst@gentoo.org>
To: Daniel Kraft <d@domob.eu>
Cc: Andy Wingo <wingo@pobox.com>, Ken Raeburn <raeburn@raeburn.org>,
guile-devel <guile-devel@gnu.org>,
Neil Jerram <neil@ossau.uklinux.net>
Subject: Re: Elisp lexical-let
Date: Wed, 22 Jul 2009 15:00:40 +0200 [thread overview]
Message-ID: <4A670D78.3040804@gentoo.org> (raw)
In-Reply-To: <4A66D7BF.5060606@domob.eu>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Daniel Kraft wrote:
> Ken Raeburn wrote:
>> On Jul 21, 2009, at 15:48, Daniel Kraft wrote:
>>> 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).
>>
>> Oh, don't stop there... let's get some buffer-local or frame-local
>> bindings into the mix too! :-)
>> There are probably corner cases where the only "specification" you're
>> likely to find is "what Emacs does when you try it". And, if the goal
>> is to support the existing body of Lisp code (e.g., if Emacs 24 goes
>> out with lexical binding support, and people start using it), there's
>> a tradeoff between what seems logical or convenient to you, and what
>> behavior of Emacs the existing code is going to expect. Maybe not in
>> weird corner cases, but cases like you describe above seem likely, and
>> I think you'd want to mimic whatever behavior Emacs is going to do.
>
> It seemed really hard to me to find at least *basic* information about
> how the lexbind things works; I did build now an emacs with lexbind from
> trunk, but so far as I see this is not meant to implement "lexical-let"
> as the cl package does, but rather allows switching all bindings from
> dynamic to lexical within one source file.
>
> While this is certainly something we could do, too (best via compiler
> options, I guess?), it is not what I had in mind as the "extension" --
> this being implementing the lexical-let as additional construct that
> establishes lexical binding for certain variables just temporarily.
>
> And checks with the cl package's implementation of lexical-let give the
> result, that an inner let does the same as if it was another
> lexical-let; that is, does not revert to dynamic binding but rather sets
> only the lexical value.
>
> So, what are the opinions regarding lexical-let as an extension
> construct? Regarding the behaviour, to me the one described above seems
> to be a consequence of the implementing with unwind-protect and not
> necessarily expected -- thus I suggest to implement the version I had in
> mind, namely that an inner let or argument binding inside a lambda
> reverts to dynamic binding for that inner scope. This seems more
> consistent and reasonable to me.
>
> Yours,
> Daniel
>
Guile also has lexical and dynamic variables; the fluids[1]. Queinnec in his
book LiSP also describes a system that has (default) lexical and dynamic
variable, on page 44. In both cases to find the value of a non-default variable
a function is used. Translated to elisp where the situation is dynamic by
default you probably want something like `(lexical x)' to dereference the
lexical variable `x' and also lexical-set(q).
It seems to me that only the dereferencing of variables is dynamic or lexical,
not the binding. Thus you don't even need lexical-let and `(lexical x)' would be
`x' found in the lexical environment (if it isn't found you can generate an
error) and `x' would be searched for in the dynamic environment. Does that make
sense?
[1]:http://www.gnu.org/software/guile/manual/guile.html#Fluids-and-Dynamic-States
Marijn
- --
If you cannot read my mind, then listen to what I say.
Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-{lisp,ml} on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkpnDXgACgkQp/VmCx0OL2zpcgCgg2QtK7kL5YJCeVP6hpG87h0f
DCMAn3rgkDIk2GYBqnHJ/JRzjsW7ehBw
=e0Hz
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2009-07-22 13:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 19:48 Elisp lexical-let Daniel Kraft
2009-07-21 21:46 ` Ken Raeburn
2009-07-22 9:11 ` Daniel Kraft
2009-07-22 13:00 ` Marijn Schouten (hkBst) [this message]
2009-07-22 19:24 ` Daniel Kraft
2009-07-23 15:24 ` Marijn Schouten (hkBst)
2009-07-23 16:13 ` Mark H Weaver
2009-07-23 20:53 ` Andy Wingo
2009-07-23 17:05 ` Daniel Kraft
2009-07-24 11:09 ` Marijn Schouten (hkBst)
2009-07-22 20:50 ` Ken Raeburn
2009-07-23 10:47 ` Daniel Kraft
2009-07-23 20:56 ` Andy Wingo
2009-07-24 6:50 ` Daniel Kraft
2009-07-23 20:49 ` Andy Wingo
2009-07-23 22:39 ` Andy Wingo
2009-07-24 7:08 ` Daniel Kraft
2009-07-24 11:42 ` Andy Wingo
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A670D78.3040804@gentoo.org \
--to=hkbst@gentoo.org \
--cc=d@domob.eu \
--cc=guile-devel@gnu.org \
--cc=neil@ossau.uklinux.net \
--cc=raeburn@raeburn.org \
--cc=wingo@pobox.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).