GNU bug report logs - #51368
29.0.50; `cl-case' should error on incorrect use

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Sun, 24 Oct 2021 07:53:01 UTC

Severity: normal

Tags: moreinfo

Found in version 29.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: 51368 <at> debbugs.gnu.org
Subject: Re: bug#51368: 29.0.50; `cl-case' should error on incorrect use
Date: Sun, 24 Oct 2021 19:48:54 +0200
Philipp Stephani <p.stephani2 <at> gmail.com> writes:

> This form demonstrates a few incorrect uses of `cl-case':
>
> (cl-case a
>   (nil 0)   ; doesn't match anything
>   (t 1)     ; matches everything, but too early
>   ('foo 2)) ; matches `quote' in addition to `foo'
>
> It would be nice if `cl-case' would signal an error or at least warn
> about these at macroexpansion time, since they are somewhat subtle and
> easy to get wrong.

An error from the second case would be nice, and a warning on the first
case, but the third case:

(macroexpand
 '(cl-case a
    ('foo (message "foo"))))
=> (cond ((cl-member a ''foo) (message "foo")))

and

(equal ''foo (list 'quote 'foo))

which, sure, whatever.  But I guess the question is whether we can
actually warn about that, because to the reader, the two forms are
equivalent? 

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




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

Previous Next


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