unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Elisp lexical-let
@ 2009-07-21 19:48 Daniel Kraft
  2009-07-21 21:46 ` Ken Raeburn
  2009-07-23 22:39 ` Andy Wingo
  0 siblings, 2 replies; 18+ messages in thread
From: Daniel Kraft @ 2009-07-21 19:48 UTC (permalink / raw)
  To: Ken Raeburn; +Cc: guile-devel

Hi again,

I just had some doubts about the details of lexical-let for elisp, which 
seem to be not answered by the document I linked to...  Maybe you can 
clarify these to me.

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).  Like in this example (I'm not sure if all my expected 
outputs are right, please correct me as needed):

(defvar x 1)
(defun foo () x)
(lexical-let ((x 2))
   x ; -> 2
   (foo) ; -> 1
   (setq x 3)
   x ; -> 3
   (foo) ; -> 1
   (let ((x 4))
     x ; -> 4?
     (foo) ; -> 4
     (setq x 5)
     x ; -> 5
     (foo) ; -> 5
     ) ; end the let
   x ; -> 3?
   (foo) ; -> 4
   )
x ; -> 4
(foo) ; -> 4

So in this case all references to x in the lexical scope of the let are 
to the dynamic value again, while the lexical is untouched and restored 
after leaving the let?

Have a nice evening!

Daniel

-- 
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2009-07-24 11:42 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).