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: Stefan Monnier
Subject: Re: Default lexical-binding to t
Date: Wed, 06 Nov 2024 14:26:56 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>>> 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.

That's what the compiler's warnings give you (plus a few related cases
such as the vars that are let-bound but not used within that let's
lexical scope).


        Stefan




reply via email to

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