GNU bug report logs - #75594
31.0.50; [FR]: Change equality test for Pcase non-linear patterns

Previous Next

Package: emacs;

Reported by: Eshel Yaron <me <at> eshelyaron.com>

Date: Wed, 15 Jan 2025 20:20:02 UTC

Severity: wishlist

Found in version 31.0.50

Full log


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

From: Eshel Yaron <me <at> eshelyaron.com>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 75594 <at> debbugs.gnu.org, "Michael Heerdegen via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#75594: 31.0.50; [FR]: Change equality test for Pcase
 non-linear patterns
Date: Sun, 19 Jan 2025 08:32:09 +0100
Hi,

Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Hello again,
>
>> > > 1- some kind of "contextual" pcase macro like
>> > >
>> > >     (with-equality-predicate #'equal
>> > >       `(,foo ,foo ,foo))
>> > >
>> > > 2- some kind of VAR pattern but annotated with an equality predicate in
>> > >    case this is not the first use of this identifier, so you'd write
>> > >
>> > >     `(,(var foo #'equal) ,(var foo #'equal) ,(var foo #'equal))
>
> Maybe something like
>
> (with-equality-predicate ((foo . #'equal))
>   `(,foo ,foo ,foo))
>
> ?

I'd rather not specify all affected variables explicitly, if that's what
this syntax implies.  The most important use case is to convert entire
pcase patterns to use equal semantics.  So transforming an arbitrary
pcase pattern to one where all non-linear patterns use equal should be
as simple as possible.  (Accordingly, I tend to "vote" for simply
changing the semantics to use equal, so no transformation is needed.)


Regards,

Eshel




This bug report was last modified 151 days ago.

Previous Next


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