emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lexical mumblings


From: Sam Steingold
Subject: Re: lexical mumblings
Date: 26 Oct 2001 15:49:17 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50

> * In message <address@hidden>
> * On the subject of "Re: lexical mumblings"
> * Sent on 26 Oct 2001 11:45:39 +0900
> * Honorable Miles Bader <address@hidden> writes:
>
> There are several possible ways -- for instance, a special `llet'
> form, if you just want to use lexical binding for particular cases
> [maybe in a speed critical inner loop], or perhaps putting
> `(use-lexical-binding)' at the top-level of an elisp source file,
> which would cause byte-compiler to lexically bind local variables
> instead of using the normal dynamic binding.

there are other options:

 - having `llet' and `dlet' as "main" forms and `let' as an alias to one
   of them (`dlet' by default); then (use-lexical-binding) would just do
   (defalias 'let 'llet)

 - adding CL `special' declarations, and making `let' a macro,
   like I have in CLOCC/CLLIB/elisp.lisp:

(defmacro el::let ((&rest vars) &rest forms)
  "Emacs-Lisp version of `let' (everything special)."
  `(let ,vars (declare (special ,@(mapcar #'from-list vars))) ,@forms))

   this has the advantage of ability to mix lexical and dynamic
   bindings. 

I like the latter option best.

-- 
Sam Steingold (http://www.podval.org/~sds)
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
Press any key to continue or any other key to quit.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]