unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: 31350@debbugs.gnu.org
Subject: bug#31350: 27.0; `pcase' message: "Redundant pcase pattern"
Date: Wed, 2 May 2018 17:48:35 -0700 (PDT)	[thread overview]
Message-ID: <86d352f4-5fa7-4bee-b72c-17e58aace43f@default> (raw)

I mistakenly had not removed an old version of a pcase clause that I
changed, so one of the two was redundant.  Compiling showed the
redundancy message in *Messages*.

Compiling also showed a message in *Compile Log* saying that a lexical
variable, which occurred only in the second of the clauses with
redundant patterns, was unused.

But the interpreted code worked as I wanted.  Apparently it was the
first of the two clauses (not the second, which had the "unused" lexical
variable) that was ignored when interpreting.  That lexical variable was
used when interpreting.

Can the messaging be improved, to tell you what the effect will be of
the redundant clauses when using the byte-compiled code, versus what it
might be for the interpreted code?  Can the compiler tell a user, for
example, which of a set of clauses with redundancy will (or will not) be
used?

The current messaging seems a bit confusing/incomplete.  It pointed to
the second of the two clauses, which was OK, and which had the "unused"
lexical variable (which was in fact used, at least when interpreting),
saying that it was redundant.

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?

These are the two clauses in question:

 (`,a `(not,a))
 ((and a (guard (not recursivep))) `(not ,a))

Variable RECURSIVEP is an argument passed to the function that invokes
the `pcase'.  The second clause is the good one.  It is the one that was
flagged as redundant and having an unused lexical variable.  Is it the
clause that gets pruned when compiling?  When interpreting it seems like
the first of the two clauses is not used.

In GNU Emacs 27.0.50 (build 3, x86_64-w64-mingw32)
 of 2018-03-21
Repository revision: e70d0c9e66d7a8609450b2889869d16aeb0363b5
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install -C 'CFLAGS=-O2 -static -g3''





             reply	other threads:[~2018-05-03  0:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03  0:48 Drew Adams [this message]
2018-05-03  1:16 ` bug#31350: 27.0; `pcase' message: "Redundant pcase pattern" 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
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=86d352f4-5fa7-4bee-b72c-17e58aace43f@default \
    --to=drew.adams@oracle.com \
    --cc=31350@debbugs.gnu.org \
    /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).