emacs-devel
[Top][All Lists]
Advanced

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

Re: Default lexical-binding to t


From: Jose A. Ortega Ruiz
Subject: Re: Default lexical-binding to t
Date: Wed, 06 Nov 2024 19:53:17 +0000
User-agent: Gnus/5.13 (Gnus v5.13)

On Wed, Nov 06 2024, Jim Porter wrote:

> On 11/5/2024 12:24 PM, Stefan Monnier wrote:
>>> What bothers me is how do I know whether a given Lisp file of mine
>>> will have problems under lexical-binding.  Do we have any tools which
>>> will help me determine that?
>> It's generally impossible to do that reliably (it can be reduced to
>> a variant of the halting problem), but the problem is exactly the same
>> as that of converting from dynbind to lexbind (which we do describe in
>> the manual).
>
> How about a less-reliable tool that catches some easy-to-detect problems? For
> example, look in every defun and see if the macro-expanded form of the
> function body refers to a variable that is neither 1) declared with 'defvar'
> or 2) let-bound in that function. This logic might not be exactly what we want
> since I haven't thought very long about it, but something along these lines
> could hopefully catch many errors.
>
> Even if we can't catch 100% of issues, catching 80% of them would make users'
> lives easier.

Apologies in advance if this has been suggested and discarded before, or
if I am missing something obvious, but wouldn't it be possible to have
an additional level of indirection with a new variable,
default-lexical-binding, settable in, say, early-init.el? It's not a
real solution, but at least people with lots of trouble with the new
default could just set it off in one place.

Just my 2c,
jao
-- 
A student came to the master and asked, for the master was one of them
who knew such things: "Does Emacs have the Buddha nature?" The master
contemplated this for some time, and answered: "I don't see why not,
it has about everything else."



reply via email to

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