[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Real-life examples of lexical binding in Emacs Lisp
From: |
Stefan Monnier |
Subject: |
Re: Real-life examples of lexical binding in Emacs Lisp |
Date: |
Sun, 14 Jun 2015 16:04:31 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
>> However, I would argue that for global variables, lexical binding would
>> be useful too, even by default.
I'm not sure what that means. But you can set a global value to
a variable without declaring it as dynamically scoped:
(setq my-lex-var 3)
Inside Emacs we also have a few global vars (e.g. `pi' and `argv') which
we would want to declare with something like defvar for various reasons
(providing a docstring, recording where is the declaration, etc...) yet
we don't want them to be dynamically scoped.
For `pi' we just used `setq', and for `argv' we used defvar followed by
an ugly hack called internal-make-var-non-special.
Stefan
- Re: Real-life examples of lexical binding in Emacs Lisp, (continued)
- Message not available
- Re: Real-life examples of lexical binding in Emacs Lisp, Emanuel Berg, 2015/06/17
- Re: Real-life examples of lexical binding in Emacs Lisp, Robert Thorpe, 2015/06/17
- Re: Real-life examples of lexical binding in Emacs Lisp, Pascal J. Bourguignon, 2015/06/17
- Re: Real-life examples of lexical binding in Emacs Lisp, Pascal J. Bourguignon, 2015/06/16
- Re: Real-life examples of lexical binding in Emacs Lisp, Phillip Lord, 2015/06/17
- Message not available
- Re: Real-life examples of lexical binding in Emacs Lisp, Jim Diamond, 2015/06/23
Re: Real-life examples of lexical binding in Emacs Lisp,
Stefan Monnier <=