GNU bug report logs - #59900
30.0.50; map pattern in pcase causes a byte-compile error

Previous Next

Package: emacs;

Reported by: Akira Komamura <akira.komamura <at> gmail.com>

Date: Thu, 8 Dec 2022 09:51:03 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: akira.komamura <at> gmail.com, 59900 <at> debbugs.gnu.org
Subject: bug#59900: 30.0.50; map pattern in pcase causes a byte-compile error
Date: Fri, 09 Dec 2022 19:02:32 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, but all this still doesn't answer my questions,
> unfortunately.  You-all are describing something that I cannot wrap my
> head around, because that basic question was not answered yet.

What specific question?

pcase is extensible: It allows to define new pattern types.  "rx.el"
defines a `rx' pcase pattern, "map.el" a `map' pcase pattern.  The
normal way to be able to use them is to `require' the library in which
they are defined.

Since `pcase' is a macro, the library (rx.el or map.el) must be loaded
when a `pcase' form using such a pattern is compiled.

The `rx' pattern definition in rx.el uses autoload cookies so that
compiling works even when rx.el is not loaded - it gets loaded
automatically when compiling.

The map.el `map' pcase pattern doesn't use autoloading.  The OP found a
case where compiling succeeded until some days ago without requiring
map.el explictily, and now a require is needed.  But that was only by
luck: AFAIU, map.el was already loaded in that scenario, and now it is
any more.  But there is no guarantee that the library is always loaded
when compiling arbitrary files, so one should _always_ explicitly
require map.el when the file contains pcase forms with `map' patterns -
even if this worked without in some cases in the past by luck.

The wish of the OP to make the `map' pattern in map.el `autoload'able
like the `rx' pattern in rx.el is reasonable, I can try to create a
patch.

But strictly speaking here is no bug, just the OP relying on something
that in the past worked by luck.

Hope this answers everything - else please ask specific questions.


Michael.




This bug report was last modified 2 years and 214 days ago.

Previous Next


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