From: Daniel Kraft <d@domob.eu>
To: "Marijn Schouten (hkBst)" <hkBst@gentoo.org>
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: Thu, 23 Jul 2009 19:05:46 +0200 [thread overview]
Message-ID: <4A68986A.20006@domob.eu> (raw)
In-Reply-To: <4A6880AE.9070600@gentoo.org>
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
next prev parent reply other threads:[~2009-07-23 17:05 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)
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 [this message]
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=4A68986A.20006@domob.eu \
--to=d@domob.eu \
--cc=guile-devel@gnu.org \
--cc=hkBst@gentoo.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).