[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lexical mumblings
From: |
Miles Bader |
Subject: |
Re: lexical mumblings |
Date: |
29 Oct 2001 23:14:24 +0900 |
Richard Stallman <address@hidden> writes:
> 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.
>
> I think that binding a variable in the -*- line would be a cleaner and
> more consistent interface for this.
Ah, that is good -- not only is it cleaner, but because a buffer-local
variable would be bound when visiting the file, `eval-defun' and
`eval-region' would automagically do the right thing!
As far as getting this information to the interpreter (the compiler case
is easy), I thought about the following:
(1) A normal dynamic variable, say `lexical-binding' would be set,
either by `load' seeing in the file header or via the normal
file-variable mechanism, as you suggested.
(2) Any top-level forms that produces a lambda-expression, namely
`defun' and `function' (#') [the `lambda' macro just produces
`function'] would produce not a normal `lambda' form, but
something like `llambda'.
(3) The evaluator, upon evaluting an `llambda', would lexically bind
some variable (`internal-use-lexical-binding' or whatever) to t
using whatever mechanism the interpreter uses for lexical binding.
Besides doing this, it would presumably also lexically bind the
llambda arguments, but otherwise would treat it just like a normal
lambda.
(4) `let', etc., would use lexical binding if that variable is
lexically bound.
Anyone see any flaws in this? It seems fairly straight-forward.
-Miles
--
Come now, if we were really planning to harm you, would we be waiting here,
beside the path, in the very darkest part of the forest?
- Re: lexical mumblings, (continued)
- Re: lexical mumblings, Sam Steingold, 2001/10/26
- Re: lexical mumblings, Richard Stallman, 2001/10/29
- Re: lexical mumblings, Richard Stallman, 2001/10/29
- Re: lexical mumblings, Miles Bader, 2001/10/29
- Re: lexical mumblings, Richard Stallman, 2001/10/30
- Re: lexical mumblings, Miles Bader, 2001/10/30
- Re: lexical mumblings,
Miles Bader <=
Re: lexical mumblings, Stefan Monnier, 2001/10/21
Re: lexical mumblings, Miles Bader, 2001/10/20