GNU bug report logs - #74145
31.0.50; Default lexical-binding to t

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Thu, 31 Oct 2024 20:59:02 UTC

Severity: wishlist

Tags: patch

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: psainty <at> orcon.net.nz, dancol <at> dancol.org, 74145 <at> debbugs.gnu.org, visuweshm <at> gmail.com
Subject: bug#74145: 31.0.50; Default lexical-binding to t
Date: Tue, 18 Feb 2025 15:23:24 -0500
> They definitely might not understand the differences between the two
> flavors well enough to know what to expect.  For example, warnings
> from the byte compiler about "unused lexical variable" might be
> extremely puzzling if those differences are not well understood,
> because to someone who is used to dynamic binding, the code looks
> 100% legit.

That's what the doc tries to explain:

      A warning about an unused variable may be a good hint that the
    variable was intended to be dynamically scoped (because it is
    actually used, but in another function), but it may also be an
    indication that the variable is simply really not used and could
    simply be removed.  So you need to find out which case it is, and
    based on that, either add a @code{defvar} or remove the variable
    altogether.  If removal is not possible or not desirable (typically
    because it is a formal argument and that we cannot or don't want to
    change all the callers), you can also add a leading underscore to
    the variable's name to indicate to the compiler that this is
    a variable known not to be used.)


- Stefan





This bug report was last modified 68 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.