GNU bug report logs - #21185
25.0.50; byte-compiler warn on quote lexical var

Previous Next

Package: emacs;

Reported by: stephen_leake <at> stephe-leake.org

Date: Tue, 4 Aug 2015 09:18:02 UTC

Severity: minor

Tags: wontfix

Found in version 25.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 21185 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: stephen_leake <at> stephe-leake.org, 21185 <at> debbugs.gnu.org
Subject: Re: bug#21185: 25.0.50; byte-compiler warn on quote lexical var
Date: Thu, 08 Jul 2021 16:12:47 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> I've been bitten by this problem when converting code to use lexical
>> binding; it would be helpful if the byte-compiler warned about it.
>
> Agreed, but I haven't figured out how to make this work.
> There are two problems:
> 1- detect not just things like « 'var » but also things like « '(var1
>    var2 var3) » since such occur in a few places as well.
> 2- don't swamp the user with false positives.
>
> Problem 2 is by far the biggest.  It's very common to have a local
> variable `face' and at the same time to use the symbol `face' (quoted),
> for example.

So the suggestion is to have code like

(let ((foo "bar"))
  (when (zot 'foo)
     ...))

give a warning (in lexical code)?  That does sound useful, especially if
the `zot' here is `bound-and-true-p', which somebody was using in a
different bug report the other week.

But I think that Stefan is totally correct in 2) -- there will be so
many false positives that it won't be useful.  So I'm closing this bug
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 316 days ago.

Previous Next


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