all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#31350: 27.0; `pcase' message: "Redundant pcase pattern"
@ 2018-05-03  0:48 Drew Adams
  2018-05-03  1:16 ` Michael Heerdegen
  2020-08-20 15:55 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 15+ messages in thread
From: Drew Adams @ 2018-05-03  0:48 UTC (permalink / raw)
  To: 31350

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''





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-12-12 19:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.