bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#21185: 25.0.50; byte-compiler warn on quote lexical var


From: Lars Ingebrigtsen
Subject: bug#21185: 25.0.50; byte-compiler warn on quote lexical var
Date: Thu, 08 Jul 2021 16:12:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <monnier@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





reply via email to

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