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

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

bug#69108: false-positive warning "variable ‘_’ not left unused" in if-l


From: Michael Heerdegen
Subject: bug#69108: false-positive warning "variable ‘_’ not left unused" in if-let* and if-let
Date: Wed, 14 Feb 2024 02:01:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Konstantin Kharlamov <Hi-Angel@yandex.ru> writes:

> I've been writing an answer for a question on emacs.stackexchange¹ and
> to avoid nested `if` and `let` clauses I used a `if-let*`, and result
> of one of the checks I assigned to a `_` variable, because the
> variable would be left unused, it's only the check being non-nil that
> mattered.
>
> But when byte-compiled that triggered a:
>
>     test.el:6:9: Warning: variable ‘_’ not left unused
>
> …which is untrue, because it is unused.

I also find this annoying.

Currently the variable is actually used (implicitly, in the expansion),
so it's not an error in the compiler.

But the warning is not really helpful (code works as intended), and

  (_ TEST-EXPR)

is maybe even easier to read or more intuitive than the official

  (TEST-EXPR)

syntax.

Would be a one liner to make both cases generate the same expansion.
Are there any votes against this?


Michael.





reply via email to

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