GNU bug report logs -
#57915
29.0.50; Misleading warning about use of quote in clause of cl-case
Previous Next
Reported by: Jonas Bernoulli <jonas <at> bernoul.li>
Date: Sun, 18 Sep 2022 19:36:02 UTC
Severity: normal
Tags: moreinfo
Found in version 29.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57915 in the body.
You can then email your comments to 57915 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57915
; Package
emacs
.
(Sun, 18 Sep 2022 19:36:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jonas Bernoulli <jonas <at> bernoul.li>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 18 Sep 2022 19:36:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I inherited some code like this:
(cl-case foo
((quote) ...)
((funcall) ...))
While I probably would not have written it like this, I think it
makes sense, since (quote ...) looks like ... is being quoted. Using
((quote) ...) make it clear to the human reader that that is not what is
happening. Unfortunately the byte-compiler now provides this misleading
warning:
Warning: Case (quote) will match ‘quote’. If that’s intended,
write (nil quote) instead. Otherwise, don’t quote ‘nil’.
This is misleading because the conditions (quote) and (nil quote) are
not equivalent; obviously the first only matches `quote', while second
also matches nil. I have seen this exact warning for a few other
packages and fear that someone might blindly follow the suggestion.
Could this special case, (quote), be handled differently? I understand
we want to catch, pcase-inspired clauses like 'x. I am not sure we can
tell the difference between (quote), (quote nil) and 'nil, but it seems
to me, that if that is not the case, we should avoid the invalid
recommendation at the cost of not warning about the other, likely
unintended uses.
Cheers,
Jonas
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57915
; Package
emacs
.
(Mon, 19 Sep 2022 08:33:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 57915 <at> debbugs.gnu.org (full text, mbox):
Jonas Bernoulli <jonas <at> bernoul.li> writes:
> I inherited some code like this:
>
> (cl-case foo
> ((quote) ...)
> ((funcall) ...))
>
> While I probably would not have written it like this, I think it
> makes sense, since (quote ...) looks like ... is being quoted. Using
> ((quote) ...) make it clear to the human reader that that is not what is
> happening. Unfortunately the byte-compiler now provides this misleading
> warning:
>
> Warning: Case (quote) will match ‘quote’. If that’s intended,
> write (nil quote) instead. Otherwise, don’t quote ‘nil’.
[...]
> Could this special case, (quote), be handled differently? I understand
> we want to catch, pcase-inspired clauses like 'x. I am not sure we can
> tell the difference between (quote), (quote nil) and 'nil, but it seems
> to me, that if that is not the case, we should avoid the invalid
> recommendation at the cost of not warning about the other, likely
> unintended uses.
Yeah, since there isn't really any other way to express this (or is
there?), we should probably not warn about this construction.
I've added Philipp to the CCs; perhaps he has some comments.
Added tag(s) moreinfo.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 19 Sep 2022 08:35:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57915
; Package
emacs
.
(Mon, 19 Sep 2022 11:39:01 GMT)
Full text and
rfc822 format available.
Message #13 received at 57915 <at> debbugs.gnu.org (full text, mbox):
On Mon, 19 Sept 2022 at 10:32, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
>
> Jonas Bernoulli <jonas <at> bernoul.li> writes:
>
> > I inherited some code like this:
> >
> > (cl-case foo
> > ((quote) ...)
> > ((funcall) ...))
> >
> > While I probably would not have written it like this, I think it
> > makes sense, since (quote ...) looks like ... is being quoted. Using
> > ((quote) ...) make it clear to the human reader that that is not what is
> > happening. Unfortunately the byte-compiler now provides this misleading
> > warning:
> >
> > Warning: Case (quote) will match ‘quote’. If that’s intended,
> > write (nil quote) instead. Otherwise, don’t quote ‘nil’.
>
> [...]
>
> > Could this special case, (quote), be handled differently? I understand
> > we want to catch, pcase-inspired clauses like 'x. I am not sure we can
> > tell the difference between (quote), (quote nil) and 'nil, but it seems
> > to me, that if that is not the case, we should avoid the invalid
> > recommendation at the cost of not warning about the other, likely
> > unintended uses.
>
> Yeah, since there isn't really any other way to express this (or is
> there?), we should probably not warn about this construction.
>
> I've added Philipp to the CCs; perhaps he has some comments.
Makes sense, fixed in commit a71de4b52d3de14349ded7d88c4cae6e2a9376ae.
--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München
Geschäftsführer: Paul Manicle, Liana Sebastian
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Diese E-Mail ist vertraulich. Falls Sie diese fälschlicherweise
erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes
weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich
bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.
This e-mail is confidential. If you received this communication by
mistake, please don’t forward it to anyone else, please erase all
copies and attachments, and please let me know that it has gone to the
wrong person.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#57915
; Package
emacs
.
(Mon, 19 Sep 2022 18:43:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 57915 <at> debbugs.gnu.org (full text, mbox):
Philipp Stephani <phst <at> google.com> writes:
> Makes sense, fixed in commit a71de4b52d3de14349ded7d88c4cae6e2a9376ae.
Thanks; I can confirm that this fixes the problem, so I'm closing this
bug report.
bug marked as fixed in version 29.1, send any further explanations to
57915 <at> debbugs.gnu.org and Jonas Bernoulli <jonas <at> bernoul.li>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 19 Sep 2022 18:43:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 18 Oct 2022 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 185 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.