[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Lexical bindings (was Re: table.el)
From: |
Kim F. Storm |
Subject: |
Lexical bindings (was Re: table.el) |
Date: |
02 Dec 2001 18:40:53 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50 |
Miles Bader <address@hidden> writes:
> Note that lexical binding is _optional_ -- a source file has to have a
> file header that turns it on, like:
>
> ;;; ... -*- lexical-binding: t -*-
>
What happens if you inhibit parsing of local variables, i.e. if
enable-local-variables is nil ?
> As Kai says, variable defined via `defvar' will still be bound
> dynamically, even in a source file that uses lexical binding.
>
If I understand this correctly, `let' and `let*' will use lexical or
dynamic binding depending on the value of `lexical-binding' - and
whether the actual variable already has a dynamic binding from
`defvar' (or `defspecial'). IMHO, this is a mess!
Since I assume that there is no existing emacs lisp code which
depends on lexical scope, I don't see why we have to make such
dramatic - and complicated - changes to the semantics of `let'.
Wouldn't it be much simpler - and easier to understand - simply to add
lexically scoped alternatives to `let' and `let*', e.g. named `local'
and `local*', and then let `let' keep its current semantics?
For example, in the following code, it is clearly indicated that xyz
has lexical scope while abc has dynamic binding:
(local ((xyx t))
(let ((abc nil))
...
))
This would also remove any dependency on whether and how xyz is
already declared, and no longer depends on whether file local
variables are evaluated when the file is loaded.
--
Kim F. Storm <address@hidden> http://www.cua.dk
- Re: Merging x*, w32* and mac* sources (was Re: table.el), (continued)
- Re: table.el, Miles Bader, 2001/12/01
- Re: table.el, Tak Ota, 2001/12/01
- Re: table.el, Tak Ota, 2001/12/01
- Re: table.el, Kai Großjohann, 2001/12/02
- Re: table.el, Miles Bader, 2001/12/02
- Lexical bindings (was Re: table.el),
Kim F. Storm <=
- Re: Lexical bindings (was Re: table.el), Kai Großjohann, 2001/12/02
- Re: Lexical bindings (was Re: table.el), Eli Zaretskii, 2001/12/02
- Re: Lexical bindings (was Re: table.el), Kim F. Storm, 2001/12/02
- Re: Lexical bindings (was Re: table.el), Stefan Monnier, 2001/12/02
- Re: Lexical bindings (was Re: table.el), Kim F. Storm, 2001/12/02
- Re: Lexical bindings (was Re: table.el), Miles Bader, 2001/12/02
- Re: Lexical bindings (was Re: table.el), Kim F. Storm, 2001/12/03
- Re: Lexical bindings (was Re: table.el), Miles Bader, 2001/12/03
- Re: Lexical bindings (was Re: table.el), Kim F. Storm, 2001/12/04
- Re: Lexical bindings (was Re: table.el), Miles Bader, 2001/12/03