emacs-devel
[Top][All Lists]
Advanced

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

Re: lexical-binding is turned on in more use cases


From: Stefan Monnier
Subject: Re: lexical-binding is turned on in more use cases
Date: Sun, 08 Mar 2020 13:33:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> > Commit e08e0880f made lexical-binding be non-nil in more use cases,
>> > but the NEWS entry doesn't say how to get back the old behavior.  Is
>> > there a way of getting back the old behavior, say, for M-: or for
>> > "--eval" options?
>> Not really, no.  You can do things like replacing `<foo>` with `(eval
>> '<foo>)` or adding a bunch of `(defvar <bar>)`, but there's no
>> config var to get back the old behavior.
> And neither can one bind something in the form being evaluated,
> AFAICS, right?

You can wrap your code inside a `(eval '...)`, but not a `let`
binding, no.

> Isn't that a bit too harsh?

I don't see why: lexical-binding gives a strict superset of what can be
done without it, and the cases where existing dynamically-scoped code gives
a different results from its interpretation with lexical-binding are
rather uncommon, especially in small chunks of code such as those
typically used in `M-:` and `--eval`.

That doesn't mean that I expect it won't break anything in practice:
I do expect that some Makefile somewhere will be broken because of
a `--eval` that depends on dynamic binding.

But I think it'll be just as easy to fix with a `defvar` or an `eval` as
it would be by setting or let-binding some new variable.


        Stefan




reply via email to

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