Re: Elisp lexical-let

2009-07-24 Thread Andy Wingo
Hi Daniel, On Fri 24 Jul 2009 09:08, Daniel Kraft writes: >> It's actually fairly simple, imo. Alpha-equivalence says that >> (lexical-let ((x a)) x) is the same as (lexical-let ((y a)) y). (Note >> that this lexical-let corresponds to Scheme's let.) So your program is >> the same as: >> >>> (le

Re: Elisp lexical-let

2009-07-24 Thread Marijn Schouten (hkBst)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Daniel Kraft wrote: > 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 >>> (lexic

Re: Elisp lexical-let

2009-07-24 Thread Daniel Kraft
Hi Andy, thanks for the clarifications! It's actually fairly simple, imo. Alpha-equivalence says that (lexical-let ((x a)) x) is the same as (lexical-let ((y a)) y). (Note that this lexical-let corresponds to Scheme's let.) So your program is the same as: (lexical-let ((y 2)) y ; -> 2 (fo

Re: Elisp lexical-let

2009-07-23 Thread Daniel Kraft
Andy Wingo wrote: I'll keep in mind also the lexbind idea of optionally making every binding lexical. Andy, can you give me a hint/example/pointer how compiler options work? This would be exactly the place to provide this, I think. Additionally we could add an option to remove the "variable is

Re: Elisp lexical-let

2009-07-23 Thread Andy Wingo
On Tue 21 Jul 2009 21:48, Daniel Kraft writes: > (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 t

Re: Elisp lexical-let

2009-07-23 Thread Andy Wingo
On Wed 22 Jul 2009 11:11, Daniel Kraft writes: > 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. Interesting

Re: Elisp lexical-let

2009-07-23 Thread Andy Wingo
Hi, On Thu 23 Jul 2009 12:47, Daniel Kraft writes: > Ken Raeburn wrote: >> On Jul 22, 2009, at 05:11, Daniel Kraft wrote: >>> 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

Re: Elisp lexical-let

2009-07-23 Thread Andy Wingo
Hi, Just for the record :) On Thu 23 Jul 2009 18:13, Mark H Weaver writes: > On Thu, Jul 23, 2009 at 05:24:30PM +0200, Marijn Schouten (hkBst) wrote: >> For the calls above all the dynamic accesses can be determined statically. >> Lexical accesses can always be determined statically. Thus all a

Re: Elisp lexical-let

2009-07-23 Thread Daniel Kraft
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

Re: Elisp lexical-let

2009-07-23 Thread Mark H Weaver
On Thu, Jul 23, 2009 at 05:24:30PM +0200, Marijn Schouten (hkBst) wrote: > For the calls above all the dynamic accesses can be determined statically. > Lexical accesses can always be determined statically. Thus all accesses in > this > example can be determined statically and can be compiled to a

Re: Elisp lexical-let

2009-07-23 Thread Marijn Schouten (hkBst)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Daniel Kraft wrote: > Hi Marijn, > > Marijn Schouten (hkBst) wrote: >> 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.

Re: Elisp lexical-let

2009-07-23 Thread Daniel Kraft
Ken Raeburn wrote: On Jul 22, 2009, at 05:11, Daniel Kraft wrote: 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 pa

Re: Elisp lexical-let

2009-07-22 Thread Ken Raeburn
On Jul 22, 2009, at 05:11, Daniel Kraft wrote: 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 r

Re: Elisp lexical-let

2009-07-22 Thread Daniel Kraft
Hi Marijn, Marijn Schouten (hkBst) wrote: 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. Tran

Re: Elisp lexical-let

2009-07-22 Thread Marijn Schouten (hkBst)
-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 express

Re: Elisp lexical-let

2009-07-22 Thread Daniel Kraft
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 bind

Re: Elisp lexical-let

2009-07-21 Thread Ken Raeburn
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