unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 31350@debbugs.gnu.org
Subject: bug#31350: 27.0; `pcase' message: "Redundant pcase pattern"
Date: Sat, 3 Oct 2020 19:06:46 -0700 (PDT)	[thread overview]
Message-ID: <c707fd78-af57-4aef-a561-6437e42b9997@default> (raw)
In-Reply-To: <87sgau93fh.fsf@web.de>

> > I'll repeat the request, which is what I think a user
> > would like to know:
> >
> >   Can the messaging at least tell you:
> >   (1) all of a set of clauses that are mutually redundant and
> >   (2) which one of them will actually be used by the compiled
> >       code, the others presumably having been pruned?
> >
> > IOW, what's the actual effect, for users?  How does pcase
> > deal with the redundancy?  Can that at least be documented
> > somewhere (maybe it is already)?
> 
> I think you make an error in reasoning: we don't have mutual redundancy
> here.  A case can be redundant when it will never match because whenever
> would match, a previous case in the cases list always matches, so it is
> effectively shadowed.  But this is not symmetric (cases are always tried
> from first to last (!), and e.g. a `_' catchall pattern in one case will
> make all following cases redundant, but not the other way round).
> 
> I think the message is more like a warning that a case can never match,
> and in all cases where this happened to me, as also in your case, the
> reason was a very obvious editing mistake.  I don't think there is much
> to say here, Emacs just tells you: this case here will never be used,
> look what you have done wrong.  There is a problem with your code
> whenever you see that message.  And there is nothing to say about the
> semantics as well.
> 
> BTW, I think the implementation only covers the most obvious and
> simplistic cases, like those involving catchall patterns or duplicated
> patterns.

If what you say is the case then the help should tell
users that.  To me it's not obvious.

And even if a user (somehow) understands that later
cases are made redundant by earlier ones, how to tell
which earlier ones are implicated?





  reply	other threads:[~2020-10-04  2:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03  0:48 bug#31350: 27.0; `pcase' message: "Redundant pcase pattern" Drew Adams
2018-05-03  1:16 ` Michael Heerdegen
2018-05-03 18:18   ` Drew Adams
2020-08-20 15:55 ` Lars Ingebrigtsen
2020-10-03 22:52   ` Michael Heerdegen
2020-10-03 22:58     ` Drew Adams
2020-10-04  1:37       ` Michael Heerdegen
2020-10-04  2:06         ` Drew Adams [this message]
2020-10-04 14:03         ` Lars Ingebrigtsen
2020-10-04 17:45           ` Drew Adams
2020-10-04 23:55             ` Michael Heerdegen
2020-10-04 23:54           ` Michael Heerdegen
2020-12-12 13:24           ` Lars Ingebrigtsen
2020-12-12 17:00             ` Drew Adams
2020-12-12 19:01               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c707fd78-af57-4aef-a561-6437e42b9997@default \
    --to=drew.adams@oracle.com \
    --cc=31350@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).