GNU bug report logs - #69108
false-positive warning "variable ‘_’ not left unused" in if-let* and if-let

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>

Date: Tue, 13 Feb 2024 21:22:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
To: Eli Zaretskii <eliz <at> gnu.org>, Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 69108 <at> debbugs.gnu.org
Subject: bug#69108: false-positive warning "variable ‘_’ not left unused" in if-let* and if-let
Date: Sat, 17 Feb 2024 12:20:16 +0300
On Sat, 2024-02-17 at 10:04 +0200, Eli Zaretskii wrote:
> > Cc: 69108 <at> debbugs.gnu.org
> > Date: Sat, 17 Feb 2024 01:28:55 +0100
> > From:  Michael Heerdegen via "Bug reports for GNU Emacs,
> >  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> > 
> > --- a/lisp/subr.el
> > +++ b/lisp/subr.el
> > @@ -2575,12 +2575,12 @@ delay-mode-hooks
> >  (defun internal--build-binding (binding prev-var)
> >    "Check and build a single BINDING with PREV-VAR."
> >    (setq binding
> > -        (cond
> > -         ((symbolp binding)
> > +        (pcase binding
> > +         ((pred symbolp)
> >            (list binding binding))
> > -         ((null (cdr binding))
> > -          (list (make-symbol "s") (car binding)))
> > -         (t binding)))
> > +         ((or `(,test) `(_ ,test))
> > +          (list (make-symbol "s") test))
> > +         (_ binding)))
> 
> Thanks, but can we please leave this as 'cond', instead of converting
> it to a 'pcase'?  It doesn't seem to be justified here, and even less
> so since you need to rewrite all the existing conditions.

Just a side note, from my experience pcase is very slow¹, so if a
function supposed to be called often, I presume it's better to avoid
`pcase`. Although, Idk how it compares to `cond`. But judging from the
fact `cond` is implemented in C, it is likely faster.

1:
https://github.com/ankurdave/color-identifiers-mode/commit/bc566bcdbd79f230b35eafd2b6c4f8428402ec09




This bug report was last modified 1 year and 147 days ago.

Previous Next


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