GNU logs - #75594, boring messages


Message sent to monnier@HIDDEN, michael_heerdegen@HIDDEN, bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Eshel Yaron <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: monnier@HIDDEN, michael_heerdegen@HIDDEN, bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 15 Jan 2025 20:20:02 +0000
Resent-Message-ID: <handler.75594.B.173697236622159 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 75594 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier@HIDDEN>, Michael Heerdegen <michael_heerdegen@HIDDEN>
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
X-Debbugs-Original-Xcc: Stefan Monnier <monnier@HIDDEN>, Michael Heerdegen <michael_heerdegen@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.173697236622159
          (code B ref -1); Wed, 15 Jan 2025 20:20:02 +0000
Received: (at submit) by debbugs.gnu.org; 15 Jan 2025 20:19:26 +0000
Received: from localhost ([127.0.0.1]:58879 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tY9rJ-0005lK-Nl
	for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 15:19:26 -0500
Received: from lists.gnu.org ([2001:470:142::17]:51486)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1tY9rG-0005ky-Vc
 for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 15:19:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1tY9r9-0000EO-5m
 for bug-gnu-emacs@HIDDEN; Wed, 15 Jan 2025 15:19:16 -0500
Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1tY9r6-0007oW-Ky
 for bug-gnu-emacs@HIDDEN; Wed, 15 Jan 2025 15:19:13 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1736972351;
 bh=Za5AYMEYZdncRTp/YZQi6rzojYYJLlm8fKPZCvSJCCc=;
 h=From:To:Subject:Date:From;
 b=LHHzbrDl1bTZuVtSEQUIyPzZdWqyhA0wosLdlnpR/keQpmbvwJhmj9Vxs8N5ZCJj9
 WOjo93hITdcsHSXa4v4kAbfCshl4/iukZBGpsqTgJBrYmXBT5LqrCy79UaeDamUGxy
 snKteonHOZOtRlpE7wTP4XtXyD0qzKm9Mdd4QlSjwPVeGOHRHj0nYhufhSN4d5ciV2
 3aosTJ+YHg+MeNKdCKhIdRa/SiJAScqsCeDnYyHunJKWFkEXgm8BUKj8tT9smCoXuZ
 ycKI7TIg102tTGr7nDlvS1uSaIp/2ku80eAwfkP/HwSOdb/MZhYvBQFYv7uD777T37
 PpCKdoHdM3N/g==
From: Eshel Yaron <me@HIDDEN>
X-Hashcash: 1:20:250115:bug-gnu-emacs@HIDDEN::9x2iitY/pIXXxaUM:4e3
Date: Wed, 15 Jan 2025 21:19:09 +0100
Message-ID: <m14j1z6daa.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@HIDDEN;
 helo=eshelyaron.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)


Hi,

I want to use non-linear pcase patterns to match against source code
with el-search, and I find the existing equality test that Pcase
generates in such cases too strict (it uses eql, and I need equal).  

I can use (pred (equal foo)) patterns instead of just repeating foo,
but I'm generating the pattern programmatically and I'd rather avoid
special-casing the first foo occurrence.

What do you think about (1) switching to equal, or (2) allowing pcase
callers to specify the equality predicate?

I can imagine (1) having compatibility implications and (2) having
performance implications, but I don't have a good sense for how
significant these would be.

As one data point, the following diff seems to enable my use case,
without breaking Emacs bootstrap nor pcase-tests.el:

diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index a6a4751f49a..4f0fe6b64ab 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -1055,7 +1055,7 @@ pcase--u1
               (pcase--u1 matches code (cons (list upat sym) vars) rest)
             ;; Non-linear pattern.  Turn it into an `eq' test.
             (setcdr (cdr v) 'used)
-            (pcase--u1 (cons `(match ,sym . (pred (eql ,(cadr v))))
+            (pcase--u1 (cons `(match ,sym . (pred (equal ,(cadr v))))
                              matches)
                        code vars rest))))
        ((eq (car-safe upat) 'app)



Thanks,

Eshel




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Eshel Yaron <me@HIDDEN>
Subject: bug#75594: Acknowledgement (31.0.50; [FR]: Change equality test
 for Pcase non-linear patterns)
Message-ID: <handler.75594.B.173697236622159.ack <at> debbugs.gnu.org>
References: <m14j1z6daa.fsf@HIDDEN>
X-Gnu-PR-Message: ack 75594
X-Gnu-PR-Package: emacs
Reply-To: 75594 <at> debbugs.gnu.org
Date: Wed, 15 Jan 2025 20:20:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

As you requested using X-Debbugs-CC, your message was also forwarded to
  Stefan Monnier <monnier@HIDDEN>, Michael Heerdegen <michael_hee=
rdegen@HIDDEN>
(after having been given a bug report number, if it did not have one).

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 75594 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
75594: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D75594
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Eshel Yaron <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 15 Jan 2025 22:27:02 +0000
Resent-Message-ID: <handler.75594.B.173697999513196 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 75594 <at> debbugs.gnu.org
Cc: michael_heerdegen@HIDDEN, monnier@HIDDEN
X-Debbugs-Original-To: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 75594 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.173697999513196
          (code B ref -1); Wed, 15 Jan 2025 22:27:02 +0000
Received: (at submit) by debbugs.gnu.org; 15 Jan 2025 22:26:35 +0000
Received: from localhost ([127.0.0.1]:59132 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYBqM-0003Ql-OQ
	for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 17:26:35 -0500
Received: from lists.gnu.org ([2001:470:142::17]:50496)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1tYBqK-0003QG-Ju
 for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 17:26:33 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1tYBqD-0005ve-84
 for bug-gnu-emacs@HIDDEN; Wed, 15 Jan 2025 17:26:25 -0500
Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1tYBqB-0005VE-Od
 for bug-gnu-emacs@HIDDEN; Wed, 15 Jan 2025 17:26:24 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1736979982;
 bh=EgnFFNt5fQPTZvn3e9fLmnwIKblKsH/C44vQ8YcnHOk=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=pvXvRL+CsSEIOqR+DCUm5f12tdhgY7BakcDekm5jTkDcNmScDZI0P8hRmsKLrF2dd
 VH4sfRubIjrp9ZtDkan/P1jx188QZDl+e28uECn7HBg2kwFVdssIReOv+reYwNbVZR
 4USTl+IUajY9pYqYsmYbpYLYLyB05tPFVyeT4XtJW20MhgdSsSlbRVqctEf6gFUqts
 FJurljqQ0wU98yCYp6Rf21V2JMimaxpspiVSH1AQza2NdZNorBHRZUHIhPsINTzHYt
 cT85k8jV3Hb2MrfFwRxgItObRdJYLhVARNQg1abvBpmGeodQRpE7HBhHsjZBum0Mlk
 IqfDthFi5/dGQ==
From: Eshel Yaron <me@HIDDEN>
In-Reply-To: <m14j1z6daa.fsf@HIDDEN> (Eshel Yaron via's message of
 "Wed, 15 Jan 2025 21:19:09 +0100")
References: <m14j1z6daa.fsf@HIDDEN>
Date: Wed, 15 Jan 2025 23:26:19 +0100
Message-ID: <m1sepj4stw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@HIDDEN;
 helo=eshelyaron.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

Eshel Yaron writes:

> What do you think about (1) switching to equal, or (2) allowing pcase
> callers to specify the equality predicate?
>
> I can imagine (1) having compatibility implications and (2) having
> performance implications, but I don't have a good sense for how
> significant these would be.

On second thought, it should be doable without affecting existing code.
The patch below adds a pattern (cheq EQ) that succeeds while changing
the equality predicate to EQ for subsequent patterns on the same branch.

With it, we get:

--8<---------------cut here---------------start------------->8---
(pcase '((foo) (foo))
  ((and (cheq equal) `(,bar ,bar ,bar)) 'a)
  (`(,bar ,bar)                         'b)
  ((and (cheq equal) `(,bar ,bar))      'c))
=> c
--8<---------------cut here---------------end--------------->8---

So I can just wrap my pattern in (and (cheq equal) ...) to use equal for
non-linear patterns.

WDYT?


diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index a6a4751f49a..483aa9b8434 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -522,7 +522,7 @@ pcase--macroexpand
     (cond
      ((null head)
       (if (pcase--self-quoting-p pat) `',pat pat))
-     ((memq head '(pred guard quote)) pat)
+     ((memq head '(pred guard quote cheq)) pat)
      ((memq head '(or and)) `(,head ,@(mapcar #'pcase--macroexpand (cdr pat))))
      ((eq head 'app) `(app ,(nth 1 pat) ,(pcase--macroexpand (nth 2 pat))))
      (t
@@ -591,6 +591,8 @@ pcase--if
    ((eq then :pcase--dontcare) `(progn (ignore ,test) ,else))
    (t (macroexp-if test then else))))
 
+(defvar pcase--equal #'eql)
+
 ;; Note about MATCH:
 ;; When we have patterns like `(PAT1 . PAT2), after performing the `consp'
 ;; check, we want to turn all the similar patterns into ones of the form
@@ -625,7 +627,8 @@ pcase--u
     (let* ((carbranch (car branches))
            (match (car carbranch)) (cdarbranch (cdr carbranch))
            (code (car cdarbranch))
-           (vars (cdr cdarbranch)))
+           (vars (cdr cdarbranch))
+           (pcase--equal #'eql))
       (pcase--u1 (list match) code vars (cdr branches)))))
 
 (defun pcase--and (match matches)
@@ -1053,9 +1056,9 @@ pcase--u1
         (let ((v (assq upat vars)))
           (if (not v)
               (pcase--u1 matches code (cons (list upat sym) vars) rest)
-            ;; Non-linear pattern.  Turn it into an `eq' test.
+            ;; Non-linear pattern.  Turn it into an equality test.
             (setcdr (cdr v) 'used)
-            (pcase--u1 (cons `(match ,sym . (pred (eql ,(cadr v))))
+            (pcase--u1 (cons `(match ,sym . (pred (,pcase--equal ,(cadr v))))
                              matches)
                        code vars rest))))
        ((eq (car-safe upat) 'app)
@@ -1112,6 +1115,9 @@ pcase--u1
                      (pcase--u rest))
                    vars
                    (list `((and . ,matches) ,code . ,vars))))
+       ((eq (car-safe upat) 'cheq)
+        (let ((pcase--equal (cadr upat)))
+          (pcase--u1 matches code vars rest)))
        (t (error "Unknown pattern `%S'" upat)))))
    (t (error "Incorrect MATCH %S" (car matches)))))
 




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Eshel Yaron <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 15 Jan 2025 22:27:02 +0000
Resent-Message-ID: <handler.75594.B75594.173697998513156 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 75594 <at> debbugs.gnu.org
Cc: michael_heerdegen@HIDDEN, monnier@HIDDEN
X-Debbugs-Original-To: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 75594 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 75594-submit <at> debbugs.gnu.org id=B75594.173697998513156
          (code B ref 75594); Wed, 15 Jan 2025 22:27:02 +0000
Received: (at 75594) by debbugs.gnu.org; 15 Jan 2025 22:26:25 +0000
Received: from localhost ([127.0.0.1]:59129 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYBqD-0003Q5-4f
	for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 17:26:25 -0500
Received: from mail.eshelyaron.com ([107.175.124.16]:53952 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1tYBqA-0003Pu-OW
 for 75594 <at> debbugs.gnu.org; Wed, 15 Jan 2025 17:26:23 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1736979982;
 bh=EgnFFNt5fQPTZvn3e9fLmnwIKblKsH/C44vQ8YcnHOk=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=pvXvRL+CsSEIOqR+DCUm5f12tdhgY7BakcDekm5jTkDcNmScDZI0P8hRmsKLrF2dd
 VH4sfRubIjrp9ZtDkan/P1jx188QZDl+e28uECn7HBg2kwFVdssIReOv+reYwNbVZR
 4USTl+IUajY9pYqYsmYbpYLYLyB05tPFVyeT4XtJW20MhgdSsSlbRVqctEf6gFUqts
 FJurljqQ0wU98yCYp6Rf21V2JMimaxpspiVSH1AQza2NdZNorBHRZUHIhPsINTzHYt
 cT85k8jV3Hb2MrfFwRxgItObRdJYLhVARNQg1abvBpmGeodQRpE7HBhHsjZBum0Mlk
 IqfDthFi5/dGQ==
From: Eshel Yaron <me@HIDDEN>
In-Reply-To: <m14j1z6daa.fsf@HIDDEN> (Eshel Yaron via's message of
 "Wed, 15 Jan 2025 21:19:09 +0100")
References: <m14j1z6daa.fsf@HIDDEN>
Date: Wed, 15 Jan 2025 23:26:19 +0100
Message-ID: <m1sepj4stw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eshel Yaron writes:

> What do you think about (1) switching to equal, or (2) allowing pcase
> callers to specify the equality predicate?
>
> I can imagine (1) having compatibility implications and (2) having
> performance implications, but I don't have a good sense for how
> significant these would be.

On second thought, it should be doable without affecting existing code.
The patch below adds a pattern (cheq EQ) that succeeds while changing
the equality predicate to EQ for subsequent patterns on the same branch.

With it, we get:

--8<---------------cut here---------------start------------->8---
(pcase '((foo) (foo))
  ((and (cheq equal) `(,bar ,bar ,bar)) 'a)
  (`(,bar ,bar)                         'b)
  ((and (cheq equal) `(,bar ,bar))      'c))
=> c
--8<---------------cut here---------------end--------------->8---

So I can just wrap my pattern in (and (cheq equal) ...) to use equal for
non-linear patterns.

WDYT?


diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index a6a4751f49a..483aa9b8434 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -522,7 +522,7 @@ pcase--macroexpand
     (cond
      ((null head)
       (if (pcase--self-quoting-p pat) `',pat pat))
-     ((memq head '(pred guard quote)) pat)
+     ((memq head '(pred guard quote cheq)) pat)
      ((memq head '(or and)) `(,head ,@(mapcar #'pcase--macroexpand (cdr pat))))
      ((eq head 'app) `(app ,(nth 1 pat) ,(pcase--macroexpand (nth 2 pat))))
      (t
@@ -591,6 +591,8 @@ pcase--if
    ((eq then :pcase--dontcare) `(progn (ignore ,test) ,else))
    (t (macroexp-if test then else))))
 
+(defvar pcase--equal #'eql)
+
 ;; Note about MATCH:
 ;; When we have patterns like `(PAT1 . PAT2), after performing the `consp'
 ;; check, we want to turn all the similar patterns into ones of the form
@@ -625,7 +627,8 @@ pcase--u
     (let* ((carbranch (car branches))
            (match (car carbranch)) (cdarbranch (cdr carbranch))
            (code (car cdarbranch))
-           (vars (cdr cdarbranch)))
+           (vars (cdr cdarbranch))
+           (pcase--equal #'eql))
       (pcase--u1 (list match) code vars (cdr branches)))))
 
 (defun pcase--and (match matches)
@@ -1053,9 +1056,9 @@ pcase--u1
         (let ((v (assq upat vars)))
           (if (not v)
               (pcase--u1 matches code (cons (list upat sym) vars) rest)
-            ;; Non-linear pattern.  Turn it into an `eq' test.
+            ;; Non-linear pattern.  Turn it into an equality test.
             (setcdr (cdr v) 'used)
-            (pcase--u1 (cons `(match ,sym . (pred (eql ,(cadr v))))
+            (pcase--u1 (cons `(match ,sym . (pred (,pcase--equal ,(cadr v))))
                              matches)
                        code vars rest))))
        ((eq (car-safe upat) 'app)
@@ -1112,6 +1115,9 @@ pcase--u1
                      (pcase--u rest))
                    vars
                    (list `((and . ,matches) ,code . ,vars))))
+       ((eq (car-safe upat) 'cheq)
+        (let ((pcase--equal (cadr upat)))
+          (pcase--u1 matches code vars rest)))
        (t (error "Unknown pattern `%S'" upat)))))
    (t (error "Incorrect MATCH %S" (car matches)))))
 




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Stefan Monnier <monnier@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 16 Jan 2025 00:49:01 +0000
Resent-Message-ID: <handler.75594.B75594.17369885085946 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eshel Yaron <me@HIDDEN>
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 75594 <at> debbugs.gnu.org
Received: via spool by 75594-submit <at> debbugs.gnu.org id=B75594.17369885085946
          (code B ref 75594); Thu, 16 Jan 2025 00:49:01 +0000
Received: (at 75594) by debbugs.gnu.org; 16 Jan 2025 00:48:28 +0000
Received: from localhost ([127.0.0.1]:59327 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYE3f-0001Xp-Ks
	for submit <at> debbugs.gnu.org; Wed, 15 Jan 2025 19:48:27 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7540)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tYE3b-0001Xa-PP
 for 75594 <at> debbugs.gnu.org; Wed, 15 Jan 2025 19:48:25 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5F2B04423BB;
 Wed, 15 Jan 2025 19:48:16 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1736988495;
 bh=Rem7jc1Iembk/enyjH7P1z3dEkr0x5Rle3X0v30Om9c=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=OuCW8F2oi7VlyHziMbIrp2aPqVeT1x7B5tRAN0N9l95MEmeJz5jc1lKCslHYpgkEF
 QNpDrZADuoSIUV/bNPjT2lDhd9nsixssw8NIXq8Xcz7m6N4I0iJUK3JI41yPZvLCNG
 z0/WfO2G/mLe1q5gXYMz6B8z7iQ2cyO+wOkQM9pmhE5Y0F1U3GO7CYRuu4AQZOa/hX
 h2cASTInwqPMsFy/RsNb5zOUdi7bzvmRmJ9zQNjToBg9SfzcxffLWkAo0b5bgauVeR
 AqZNpDsmEHe06vewarNtPmooNw+7/ikOrHW7xGklkiWSfrH59qUmd43luckIbWpYw8
 XXBSD/RBYbSoA==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3A22F4423AA;
 Wed, 15 Jan 2025 19:48:15 -0500 (EST)
Received: from alfajor (104-195-232-86.cpe.teksavvy.com [104.195.232.86])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 03266120234;
 Wed, 15 Jan 2025 19:48:14 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <m14j1z6daa.fsf@HIDDEN> (Eshel Yaron's message of "Wed, 
 15 Jan 2025 21:19:09 +0100")
Message-ID: <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN>
References: <m14j1z6daa.fsf@HIDDEN>
Date: Wed, 15 Jan 2025 19:48:14 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.008 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> I want to use non-linear pcase patterns to match against source code
> with el-search, and I find the existing equality test that Pcase
> generates in such cases too strict (it uses eql, and I need equal).

Funny, I was reminded yesterday that this equality test is `eql` whereas
Pcase uses `equal` "everywhere else".

> What do you think about (1) switching to equal,

On the principle, I'm in favor (I think that's what we should have
used all along), but the problem is the risk of breaking existing code.

> or (2) allowing pcase callers to specify the equality predicate?
[...]
> The patch below adds a pattern (cheq EQ) that succeeds while changing
> the equality predicate to EQ for subsequent patterns on the same branch.

Making the semantics of the VAR pattern depend on whether some other
pattern has been seen earlier or not strikes me as hideous (tho clearly
the non-linearity-becomes-an-equality-constraint is exactly doing that).

I can see two possible syntax options:

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


Stefan





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Eshel Yaron <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Thu, 16 Jan 2025 06:51:02 +0000
Resent-Message-ID: <handler.75594.B75594.17370102468895 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Stefan Monnier <monnier@HIDDEN>
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 75594 <at> debbugs.gnu.org
Received: via spool by 75594-submit <at> debbugs.gnu.org id=B75594.17370102468895
          (code B ref 75594); Thu, 16 Jan 2025 06:51:02 +0000
Received: (at 75594) by debbugs.gnu.org; 16 Jan 2025 06:50:46 +0000
Received: from localhost ([127.0.0.1]:59754 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYJiI-0002JM-0i
	for submit <at> debbugs.gnu.org; Thu, 16 Jan 2025 01:50:46 -0500
Received: from mail.eshelyaron.com ([107.175.124.16]:36444 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1tYJiE-0002J9-6c
 for 75594 <at> debbugs.gnu.org; Thu, 16 Jan 2025 01:50:44 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1737010241;
 bh=Oj5YsgvruUUR9fz+1ZZyX14UCAild7KEMVVfXk0OH7Q=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=LWu3AaZxufk3VfSW5lynyYjJ+7QPcUEGQTPOG/2TPWFwMYJCMxuMDTgSF9iAd0I0d
 zhAeoRQrxLiNizG9+H56CDUlV3KSRhntrHsGkJlL3f5fXtQzLxpbmSTwyJ9nMKlirx
 jTiHW0Z57J4k5yn/g7OeNL3Lged6gqb6H72221msRtHX1cZl2H1jCnfgBWHSXESjn+
 c2aIVXzwexciJGrLaSYfl1xTkn+T+ttLbxw438ZOJrTNmnrR8Cw8GaGjoqPsy0b0Ly
 0XyorRKxW1mQKIjTRZDW0H12bVgWwz6rZIG2/DSdyC86Vetik+PlSLbD4bk9O58nij
 hrvmo4TLYfQpA==
From: Eshel Yaron <me@HIDDEN>
In-Reply-To: <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Wed, 15 Jan 2025 19:48:14 -0500")
References: <m14j1z6daa.fsf@HIDDEN>
 <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN>
Date: Thu, 16 Jan 2025 07:50:39 +0100
Message-ID: <m1h65z45hc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Stefan Monnier <monnier@HIDDEN> writes:

>> I want to use non-linear pcase patterns to match against source code
>> with el-search, and I find the existing equality test that Pcase
>> generates in such cases too strict (it uses eql, and I need equal).
>
> Funny, I was reminded yesterday that this equality test is `eql` whereas
> Pcase uses `equal` "everywhere else".
>
>> What do you think about (1) switching to equal,
>
> On the principle, I'm in favor (I think that's what we should have
> used all along), but the problem is the risk of breaking existing code.
>
>> or (2) allowing pcase callers to specify the equality predicate?
> [...]
>> The patch below adds a pattern (cheq EQ) that succeeds while changing
>> the equality predicate to EQ for subsequent patterns on the same branch.
>
> Making the semantics of the VAR pattern depend on whether some other
> pattern has been seen earlier or not strikes me as hideous (tho clearly
> the non-linearity-becomes-an-equality-constraint is exactly doing that).
>
> I can see two possible syntax options:
>
> 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))

Both options sound good.  The need to repeat the equality predicate
multiple times in option 2 makes it slightly less preferable, but it
maybe it'd be easier to document/explain.


Thanks,

Eshel






Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 17 Jan 2025 01:01:02 +0000
Resent-Message-ID: <handler.75594.B75594.173707565028058 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eshel Yaron <me@HIDDEN>
Cc: 75594 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 75594-submit <at> debbugs.gnu.org id=B75594.173707565028058
          (code B ref 75594); Fri, 17 Jan 2025 01:01:02 +0000
Received: (at 75594) by debbugs.gnu.org; 17 Jan 2025 01:00:50 +0000
Received: from localhost ([127.0.0.1]:35274 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYajB-0007IT-U8
	for submit <at> debbugs.gnu.org; Thu, 16 Jan 2025 20:00:50 -0500
Received: from mout.web.de ([212.227.17.11]:40065)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1tYaj9-0007ID-9x
 for 75594 <at> debbugs.gnu.org; Thu, 16 Jan 2025 20:00:48 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1737075633; x=1737680433;
 i=michael_heerdegen@HIDDEN;
 bh=wT5x0Pf5+CvSxVprE46XRrokU6ScRXDCVt+W+59+RvU=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=ZWRMozmWaVRqxnbMTiN2toxFsXLaNCJlOaf4buL4/k3UD9jmpIaAX+wFx32slAHt
 CIwdGt2ljV0V635DTK75Lmy1njuZ1HItE+de43ozZrB1qRzuSOrISaeK1m7VmemQs
 XbsNif1MzmxPB/wgz8F0ebU50P+TTol5EbTV5Ej2sFVh5HqgzWOoDMVNPT3tTQV5Q
 yJv1/KLQzNGpjMiSULrawGHC9kfgKXao3opm6QRi+4XPXPfTDPuzexEFCzmKOza6B
 7aeK4fENpLRakRK6maX56jKUrCDC0fTV74VJYI3Y2WWUxDDYbDt/teLszRks9mOoL
 FwJ0MmeZlWTYEnr4pQ==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb106
 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MFJjP-1tjHxI2MGH-009Wsb; Fri, 17
 Jan 2025 02:00:33 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <m1h65z45hc.fsf@HIDDEN> (Eshel Yaron's message of "Thu, 
 16 Jan 2025 07:50:39 +0100")
References: <m14j1z6daa.fsf@HIDDEN>
 <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN>
 <m1h65z45hc.fsf@HIDDEN>
Date: Fri, 17 Jan 2025 02:01:47 +0100
Message-ID: <87wmeui77o.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:ZydmcBON284FyFFxCp8t3w+rdBP4ywhHxR2QaOtHs3fWulpliKG
 yOdXVfhQone9INaW/g13YTYQ3McSnqMMQwendJIMhA6QX68rJYXIhjYFLm9g8u2btfS+Tnw
 cs03KAQlbGMQAnWHLYnZyHpxP6S/X6xcPbU2G5d+1HWKcTwyMrGGXBjgMp7LxWkS1mrNakI
 pos4HhQCIk4dI2BXOwz0A==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:QEYZbVNPiCs=;NnqHvNBODImDwGLyWfGOPFHxY2V
 eLLp3bzXgHbNVtmpoSBYyLsMNazCMeR4GrXfLLGE6OAvjauAXynwKJLx6tjxOIBC4awG6xA2+
 4HHDs0WxaqEsNJN28AuylUVCvj6qXt/Xg3fUKds8jLpKbXPbMFKvk4IRYvaCrABDG/jKoJZp7
 5OhE4j1qk6oaaWSUrowz92JXfWAxJY7gImwZDARx4v3/i3m8kwv6sOD8eOARwghtGTtAgil6u
 xBWqQGX0BZMjc0Ye0irVX9cBpfMRmr1R2CiyDNrSQelqqwkyfgJ4HQ9N8fHg5ISSuwyyUuovG
 soedL0eDa+UQUkM5d81yxwrYYK9x1QYMP5xIFXkIrcNdN3v+wyNFFMbVh9D6s1OPj5Dbif1nh
 dKFlp8RmHck0DHZQaoB3ewwfPBMckUx0aRaarbBr3qIpqCkrziIbYBxVZsXf+EBzPaTFUKBE9
 EV03hvJRwuyhp3JF4a63k2MIKDWA0b7E7+BC+Gk+KcSaCoP7hV/BiPWbhFx+TbDGtCbM2HNNl
 v/1ELlY4iUp2UlCSJ0BY7RPwy9zp1Fcy0YIJ3wGixhOszncjX/f8q+MrPjRQkHIuXzD00d59e
 NYc9aciyp0mUA5Xzx7vbU0KqHUEchZRg0Bu3Q5m05hgdk8di0wXFybScTBFDwnUxxUAuDJ6Y9
 TRA5y2G5TWCHfAKNhV6ZN6PE08yiZN5CycBcQIfWUfWV6UyXsOTOUcNNDd5RPT1KN2QAuDgYe
 6GN4d4xJO2cnojleEmFI6aJ5K4Ko1v7MW74Vjf+PNVJ4zV5Y7jPipH6eTi0DKlDFl5/U0Si82
 n8fEbIGGczMuKgkugd0o0ne5z6L9cvXBey2UGxa42MatTJvQGmY0BSfW9YpEdxgLS9/ZlfRBH
 ogpNoB8jhZcFEWUlfCkRhXqtV954cH3oKb14AdpEAYfRWTtMbvLelDew0PioAjYGlq06SgjmQ
 rqRGpMrkiVQSnGLwucuFZDSt2v+Q1yeF0F2KzlKeI9VfSZUJYSgm2wAMycSskfU29Ke48k4Lk
 qQy8jjuD8U3g27gz9J5jfmxGkEe/VhqRDIG9OqMDAWCb63VuC3fAOyVlzn5+fHoVkfwZcOEiU
 Kp6AapEbWeExVCTLzQofimoCf4RKK7hUJRGD0sR6TM/8gSGG+mMlC3BXuBEkdK3jt0D8RLXDX
 9QSDqsFU9pJYLcXWiSWgVW6+e93b0bHKxJLYcpbNvGQ==
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eshel Yaron <me@HIDDEN> writes:

> > I can see two possible syntax options:
> >
> > 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))
>
> Both options sound good.  The need to repeat the equality predicate
> multiple times in option 2 makes it slightly less preferable, but it
> maybe it'd be easier to document/explain.

2 has the advantage that it allows mixing different predicates.  Dunno
if this is often useful, though.

I wonder how typical examples of this feature look like.  So far I
stumbled over the implicit equivalence test not being what I needed
sometimes, but not really often.

(Of course I'm open to add something (maybe more) convenient to el-search
if it is useful.)


Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 17 Jan 2025 23:09:02 +0000
Resent-Message-ID: <handler.75594.B.173715530318654 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 75594 <at> debbugs.gnu.org
Cc: me@HIDDEN, monnier@HIDDEN
X-Debbugs-Original-To: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: 75594 <at> debbugs.gnu.org, Eshel Yaron <me@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.173715530318654
          (code B ref -1); Fri, 17 Jan 2025 23:09:02 +0000
Received: (at submit) by debbugs.gnu.org; 17 Jan 2025 23:08:23 +0000
Received: from localhost ([127.0.0.1]:39267 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYvRu-0004qo-W1
	for submit <at> debbugs.gnu.org; Fri, 17 Jan 2025 18:08:23 -0500
Received: from lists.gnu.org ([2001:470:142::17]:38182)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1tYvRt-0004qX-9s
 for submit <at> debbugs.gnu.org; Fri, 17 Jan 2025 18:08:21 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1tYvRm-0004qt-Q8
 for bug-gnu-emacs@HIDDEN; Fri, 17 Jan 2025 18:08:14 -0500
Received: from mout.web.de ([212.227.15.4])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1tYvRk-0001GV-6i
 for bug-gnu-emacs@HIDDEN; Fri, 17 Jan 2025 18:08:13 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1737155279; x=1737760079;
 i=michael_heerdegen@HIDDEN;
 bh=rheyTt+oborHUymSzYqVGD8yN45SfJzKTp3t5bNy2DM=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=bw7XQ79HXGpS4dR3HWDnccUPy5gkJDz/ZbtMfiz9/dWw5K0zxaMHP3Y6dJBlYwlS
 qd3yruPMfaxSweo7gkkvm7W/7zzdtVTGbdawSRecwHZdO95Ez0dlQn3UlTWSZlpgX
 TxPjVNchGrAhtjNvDufbmCqDQkBzTod52ut5GPHHQ5OOPMZyHQy5+1ekgOpG+mE5p
 eG4baIa4D3r4rnlINOgQfxNah7Z0iOJpSFiM5nt+7f625aGAfGWY9qddGbHHR+5/+
 UOxznkvEDqdQbVvQvN4jEixnmNCa3nys908TOfqayLG2G8tYlafLh15kChjhaJ1xO
 UfM3pLWluCGsA9ccpw==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb006
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N5ljL-1tRpnJ3Yy3-010mwD; Sat, 18
 Jan 2025 00:07:58 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <87wmeui77o.fsf@HIDDEN> (Michael Heerdegen via's message of "Fri, 
 17 Jan 2025 02:01:47 +0100")
References: <m14j1z6daa.fsf@HIDDEN>
 <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN>
 <m1h65z45hc.fsf@HIDDEN> <87wmeui77o.fsf@HIDDEN>
Date: Sat, 18 Jan 2025 00:09:14 +0100
Message-ID: <87sephhwbp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:85W6d9RXiXe+kuIhwZUB3/xHZpPHtkdyHlAAEGYW7N6gjxR2o0G
 aTSon/mXOJlJysapf/GLrQ9mRCwFB3ODjU+mS5LQc7bOLVsCWk/39JOjZOiWgGkUj/PivpP
 vCR3DMuZSGtW4SwUXAdQRmzdx7DhAKye3wCdh4H8uE3GrNuvLXRg/1ZjupjUnpijol1PguD
 U17gsyDX/bLYDthSrslBA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:MrbgkeuW6Fk=;3vIwaihmXxx/Z6RlNawbiMDtVjJ
 PrEguIfCWGCW+rGvdzl7B50JHfCDLrBoz291p54Pryws+o/Fkr2HdyuBz7M9Xm9Fki+RQsSKQ
 ymwCA+Bire17ismHoq1QI4o977gZGrrAqG6lT5yHrO0SYaeEwJBaSDlc6ysF2ND8TPWW+wbmp
 940LQfaP/g6XMNRXaYe7mMeTpkl625tK7zYugFWU2RBOB0XhJnMgu0kUksqc1gTSsjM6PmiLj
 82teAFqF7DYdb+SNaCyIcWXWuKfrCaD5iUMvh7ZCUrMiAyC3plB9RovWl7sBbc8k6TV8DlfoG
 bceoDWLM2B1aUiItol/QY1l3mhWG4tq8jRgM/mWZmiJWw9zrz+A0c/ob3lBP8HbTXbTlRi9lO
 /jHFRPFfMO97TJZYEguoCMSOa57/68zx3iVkFx8O1eiXMONapYrLyA//M3hPK71l7uxRz1S48
 kYVwmYkaygJ4ult6Q9gcul7+D3zGqu/jOS0JPLe4geWYv3KjOFd4iJtMtvGUXYN6oy56ivtbf
 K4PSPUQYn0fUMm7OuVBdQk0aGogo4oaJlFvSVjag+ep9jTCWIHRInEpjMRNDGS5jEgubNyoxh
 eczB04zy67cxvBwTBMgvaEL1rZfoLNIcu7/fmXKwo1XeJABufINjXa6Urtns30iQnmloItV8z
 5NKes4ODFa71vKpNQKk6RkqtKYQLMZqKKYQjlLmdNDBINXM0m0y2Rq8E8MRx5uxg8EUsUuwjU
 smYsNpo4UbWf3uGr7LH1Qwxai+BdAnQik1qqzsevQ5KmBTREpeodxxB71WcHW5zkRc0/Iw7uV
 zyayyvaHWLciI8BoOSQoTkf3de8bk4eUxeRmdfGv9RAFVHnOjakL5t4PAzluOlJe3XWRH4u00
 x6xxWLfE7ehS4GMINHx/snzIxBfr57bLyCb0kCwNc3gK6e16GjzemZKS6B6MAde/IKmxQTpDl
 uEIUIcf/MMYpue3qQI0uly8YOG4xinuupg47YKHVLUB9tjNDxTJpCfMh/2xlR1VLpfCCaL6TH
 znRGIzAv4suIlPEzlGBLZ2vZolKehZ5DuXPQNe3CEtzPkurH+xb5mF8ChY9rT9zHYmmsK+jOj
 2zXocuQnyLD2p98NoGyCFIMKpJGG/c6Yt/hIB8opjdDqtfUrXQWFtFec+HcpZzZGwJHKoo3lb
 PmpLGg2/UH1rGHX849WCz2qfJxfDrG9OSPWwXu1o13w==
Received-SPF: pass client-ip=212.227.15.4;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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

?


Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 17 Jan 2025 23:09:02 +0000
Resent-Message-ID: <handler.75594.B75594.173715528718616 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 75594 <at> debbugs.gnu.org
Cc: me@HIDDEN, monnier@HIDDEN
X-Debbugs-Original-To: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
X-Debbugs-Original-Cc: 75594 <at> debbugs.gnu.org, Eshel Yaron <me@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 75594-submit <at> debbugs.gnu.org id=B75594.173715528718616
          (code B ref 75594); Fri, 17 Jan 2025 23:09:02 +0000
Received: (at 75594) by debbugs.gnu.org; 17 Jan 2025 23:08:07 +0000
Received: from localhost ([127.0.0.1]:39264 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tYvRf-0004qC-KH
	for submit <at> debbugs.gnu.org; Fri, 17 Jan 2025 18:08:07 -0500
Received: from mout.web.de ([212.227.15.4]:58787)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1tYvRd-0004pS-5B
 for 75594 <at> debbugs.gnu.org; Fri, 17 Jan 2025 18:08:06 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1737155279; x=1737760079;
 i=michael_heerdegen@HIDDEN;
 bh=rheyTt+oborHUymSzYqVGD8yN45SfJzKTp3t5bNy2DM=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=bw7XQ79HXGpS4dR3HWDnccUPy5gkJDz/ZbtMfiz9/dWw5K0zxaMHP3Y6dJBlYwlS
 qd3yruPMfaxSweo7gkkvm7W/7zzdtVTGbdawSRecwHZdO95Ez0dlQn3UlTWSZlpgX
 TxPjVNchGrAhtjNvDufbmCqDQkBzTod52ut5GPHHQ5OOPMZyHQy5+1ekgOpG+mE5p
 eG4baIa4D3r4rnlINOgQfxNah7Z0iOJpSFiM5nt+7f625aGAfGWY9qddGbHHR+5/+
 UOxznkvEDqdQbVvQvN4jEixnmNCa3nys908TOfqayLG2G8tYlafLh15kChjhaJ1xO
 UfM3pLWluCGsA9ccpw==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb006
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N5ljL-1tRpnJ3Yy3-010mwD; Sat, 18
 Jan 2025 00:07:58 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <87wmeui77o.fsf@HIDDEN> (Michael Heerdegen via's message of "Fri, 
 17 Jan 2025 02:01:47 +0100")
References: <m14j1z6daa.fsf@HIDDEN>
 <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN>
 <m1h65z45hc.fsf@HIDDEN> <87wmeui77o.fsf@HIDDEN>
Date: Sat, 18 Jan 2025 00:09:14 +0100
Message-ID: <87sephhwbp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:85W6d9RXiXe+kuIhwZUB3/xHZpPHtkdyHlAAEGYW7N6gjxR2o0G
 aTSon/mXOJlJysapf/GLrQ9mRCwFB3ODjU+mS5LQc7bOLVsCWk/39JOjZOiWgGkUj/PivpP
 vCR3DMuZSGtW4SwUXAdQRmzdx7DhAKye3wCdh4H8uE3GrNuvLXRg/1ZjupjUnpijol1PguD
 U17gsyDX/bLYDthSrslBA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:MrbgkeuW6Fk=;3vIwaihmXxx/Z6RlNawbiMDtVjJ
 PrEguIfCWGCW+rGvdzl7B50JHfCDLrBoz291p54Pryws+o/Fkr2HdyuBz7M9Xm9Fki+RQsSKQ
 ymwCA+Bire17ismHoq1QI4o977gZGrrAqG6lT5yHrO0SYaeEwJBaSDlc6ysF2ND8TPWW+wbmp
 940LQfaP/g6XMNRXaYe7mMeTpkl625tK7zYugFWU2RBOB0XhJnMgu0kUksqc1gTSsjM6PmiLj
 82teAFqF7DYdb+SNaCyIcWXWuKfrCaD5iUMvh7ZCUrMiAyC3plB9RovWl7sBbc8k6TV8DlfoG
 bceoDWLM2B1aUiItol/QY1l3mhWG4tq8jRgM/mWZmiJWw9zrz+A0c/ob3lBP8HbTXbTlRi9lO
 /jHFRPFfMO97TJZYEguoCMSOa57/68zx3iVkFx8O1eiXMONapYrLyA//M3hPK71l7uxRz1S48
 kYVwmYkaygJ4ult6Q9gcul7+D3zGqu/jOS0JPLe4geWYv3KjOFd4iJtMtvGUXYN6oy56ivtbf
 K4PSPUQYn0fUMm7OuVBdQk0aGogo4oaJlFvSVjag+ep9jTCWIHRInEpjMRNDGS5jEgubNyoxh
 eczB04zy67cxvBwTBMgvaEL1rZfoLNIcu7/fmXKwo1XeJABufINjXa6Urtns30iQnmloItV8z
 5NKes4ODFa71vKpNQKk6RkqtKYQLMZqKKYQjlLmdNDBINXM0m0y2Rq8E8MRx5uxg8EUsUuwjU
 smYsNpo4UbWf3uGr7LH1Qwxai+BdAnQik1qqzsevQ5KmBTREpeodxxB71WcHW5zkRc0/Iw7uV
 zyayyvaHWLciI8BoOSQoTkf3de8bk4eUxeRmdfGv9RAFVHnOjakL5t4PAzluOlJe3XWRH4u00
 x6xxWLfE7ehS4GMINHx/snzIxBfr57bLyCb0kCwNc3gK6e16GjzemZKS6B6MAde/IKmxQTpDl
 uEIUIcf/MMYpue3qQI0uly8YOG4xinuupg47YKHVLUB9tjNDxTJpCfMh/2xlR1VLpfCCaL6TH
 znRGIzAv4suIlPEzlGBLZ2vZolKehZ5DuXPQNe3CEtzPkurH+xb5mF8ChY9rT9zHYmmsK+jOj
 2zXocuQnyLD2p98NoGyCFIMKpJGG/c6Yt/hIB8opjdDqtfUrXQWFtFec+HcpZzZGwJHKoo3lb
 PmpLGg2/UH1rGHX849WCz2qfJxfDrG9OSPWwXu1o13w==
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

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

?


Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Eshel Yaron <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 19 Jan 2025 07:33:01 +0000
Resent-Message-ID: <handler.75594.B.173727194620915 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Cc: 75594 <at> debbugs.gnu.org, monnier@HIDDEN
X-Debbugs-Original-Cc: 75594 <at> debbugs.gnu.org, "Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.173727194620915
          (code B ref -1); Sun, 19 Jan 2025 07:33:01 +0000
Received: (at submit) by debbugs.gnu.org; 19 Jan 2025 07:32:26 +0000
Received: from localhost ([127.0.0.1]:44688 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZPnF-0005RH-PY
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 02:32:26 -0500
Received: from lists.gnu.org ([2001:470:142::17]:43334)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1tZPnD-0005Qo-EX
 for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 02:32:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1tZPn5-00083u-EP
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jan 2025 02:32:17 -0500
Received: from mail.eshelyaron.com ([107.175.124.16] helo=eshelyaron.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1tZPn3-0000Hd-Jp
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jan 2025 02:32:15 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1737271932;
 bh=cNFwO+eK7PavNoo8ETt5Xind7sLCK6Wo9nI82cfT4MQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Sv2mWOXq5tOb44rNpM0lVQVEvztwwdB/6WtaEM3eh33qwwg1vYNYbx6uDNy8Qcavn
 BS2CGk9oexGe//cHX9kS9umO1T65arN7KmqSh4fyw0F6X/x5HdFKZ0wJh1a//xroE7
 8V6KAFEioWtH/QrzSScWs8Q6mMUmGxLmUH6OKLQUSf3sq8RGRQXLaVrSenkurcVub0
 TzIxqS8W+Kmm9RNbOXuk6bPZtfPy/JIAHhu4mrSHrEAv6YBmAtkkoEohcBnZ1Hu+CA
 mUSw2AlCqzAaefqz03c2tUiwqJHLNa+ZC6OeLqHMhr63q+MbN3kb06k7p6Ha2EQSW/
 EKdmQHshYibnA==
From: Eshel Yaron <me@HIDDEN>
In-Reply-To: <87sephhwbp.fsf@HIDDEN> (Michael Heerdegen's message of "Sat, 18
 Jan 2025 00:09:14 +0100")
References: <m14j1z6daa.fsf@HIDDEN>
 <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN>
 <m1h65z45hc.fsf@HIDDEN> <87wmeui77o.fsf@HIDDEN>
 <87sephhwbp.fsf@HIDDEN>
Date: Sun, 19 Jan 2025 08:32:09 +0100
Message-ID: <m1tt9vdzt2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=107.175.124.16; envelope-from=me@HIDDEN;
 helo=eshelyaron.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

Hi,

Michael Heerdegen <michael_heerdegen@HIDDEN> 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




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Eshel Yaron <me@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 19 Jan 2025 07:33:02 +0000
Resent-Message-ID: <handler.75594.B75594.173727193620876 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Cc: 75594 <at> debbugs.gnu.org, monnier@HIDDEN
X-Debbugs-Original-Cc: 75594 <at> debbugs.gnu.org, "Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 75594-submit <at> debbugs.gnu.org id=B75594.173727193620876
          (code B ref 75594); Sun, 19 Jan 2025 07:33:02 +0000
Received: (at 75594) by debbugs.gnu.org; 19 Jan 2025 07:32:16 +0000
Received: from localhost ([127.0.0.1]:44682 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZPn5-0005Qe-Ic
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 02:32:15 -0500
Received: from mail.eshelyaron.com ([107.175.124.16]:56148 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1tZPn3-0005QO-08
 for 75594 <at> debbugs.gnu.org; Sun, 19 Jan 2025 02:32:13 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1737271932;
 bh=cNFwO+eK7PavNoo8ETt5Xind7sLCK6Wo9nI82cfT4MQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Sv2mWOXq5tOb44rNpM0lVQVEvztwwdB/6WtaEM3eh33qwwg1vYNYbx6uDNy8Qcavn
 BS2CGk9oexGe//cHX9kS9umO1T65arN7KmqSh4fyw0F6X/x5HdFKZ0wJh1a//xroE7
 8V6KAFEioWtH/QrzSScWs8Q6mMUmGxLmUH6OKLQUSf3sq8RGRQXLaVrSenkurcVub0
 TzIxqS8W+Kmm9RNbOXuk6bPZtfPy/JIAHhu4mrSHrEAv6YBmAtkkoEohcBnZ1Hu+CA
 mUSw2AlCqzAaefqz03c2tUiwqJHLNa+ZC6OeLqHMhr63q+MbN3kb06k7p6Ha2EQSW/
 EKdmQHshYibnA==
From: Eshel Yaron <me@HIDDEN>
In-Reply-To: <87sephhwbp.fsf@HIDDEN> (Michael Heerdegen's message of "Sat, 18
 Jan 2025 00:09:14 +0100")
References: <m14j1z6daa.fsf@HIDDEN>
 <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN>
 <m1h65z45hc.fsf@HIDDEN> <87wmeui77o.fsf@HIDDEN>
 <87sephhwbp.fsf@HIDDEN>
Date: Sun, 19 Jan 2025 08:32:09 +0100
Message-ID: <m1tt9vdzt2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Michael Heerdegen <michael_heerdegen@HIDDEN> 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




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 19 Jan 2025 22:37:01 +0000
Resent-Message-ID: <handler.75594.B.173732618831912 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eshel Yaron <me@HIDDEN>
Cc: 75594 <at> debbugs.gnu.org, monnier@HIDDEN
X-Debbugs-Original-Cc: 75594 <at> debbugs.gnu.org, "Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.173732618831912
          (code B ref -1); Sun, 19 Jan 2025 22:37:01 +0000
Received: (at submit) by debbugs.gnu.org; 19 Jan 2025 22:36:28 +0000
Received: from localhost ([127.0.0.1]:47719 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZdu6-0008IX-3a
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 17:36:28 -0500
Received: from lists.gnu.org ([2001:470:142::17]:40644)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1tZdtv-0008Hy-EF
 for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 17:36:15 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1tZdtj-0007tX-QE
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jan 2025 17:36:06 -0500
Received: from mout.web.de ([212.227.15.4])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1tZdtc-0005TT-4R
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jan 2025 17:35:58 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1737326149; x=1737930949;
 i=michael_heerdegen@HIDDEN;
 bh=NXNPD1qzwOfJWkBt0jF/O9Dscrd0VdQdv23iSCQt/zo=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=JsS8iuowm+xTQ9ACUyT5da7M6mMlVL28x/lVUborgW8PaVgtSkZlk2h0gj9UMXDc
 9A/UIjqig53FPykm6XtrCGCTlw3IpuqGwnxjVX3WLTC8eX3Ikv4i+BIZVeIT4vWlg
 yxFCJyq8Gv82e5B1jItuRoqVxbW0oOjU80uOWrkG4Zcv817uNWG1qALhnaNh1+Sxa
 NYYw+BDbYOEFvIzOwbCyNmNMMdIbjc4wdVNrCnaf+yOdI8ZjeypTaMT7+WXPOGqy5
 HbgBJ4zXcfp0gS+rTZNZHTP5yESTKyksiDeovWhZLBlvG66KnAgU6NVfGyv2Qzr9a
 tQnzIJGHM1+Jw6pKug==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb005
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MmQcf-1t94eS3All-00mfx8; Sun, 19
 Jan 2025 23:35:49 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <m1tt9vdzt2.fsf@HIDDEN> (Eshel Yaron's message of "Sun, 
 19 Jan 2025 08:32:09 +0100")
References: <m14j1z6daa.fsf@HIDDEN>
 <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN>
 <m1h65z45hc.fsf@HIDDEN> <87wmeui77o.fsf@HIDDEN>
 <87sephhwbp.fsf@HIDDEN> <m1tt9vdzt2.fsf@HIDDEN>
Date: Sun, 19 Jan 2025 23:37:05 +0100
Message-ID: <87cygiv3am.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:Kz3ztAoZG6OZTiYDpdhXzFPuf1we4TR9QleHxlcPGvJSzSTM7Kq
 9zF4DCIu+r3T28+XGvWXVBXONCOj5AU82NsKYJZ4Dvy1D4KPrOfc3krlQvBtM28gVeIhp3B
 uoUm+Ieqajh5skisJE8qymLOYkR9qbKlt8AaEpA/+YP5hPDPJIfM3Vc4Wq6HD7ryP0yZGLR
 FU3zvBd1qrMJdUNXEEUBg==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:+tocg1DW3iA=;6JJoVkjZVsPoDkl5vH4C5n6JCsB
 9vRBP+BYB/o7sekY1Xve+bC61CnKXgvh6FF/nMf5OPRAmXWvOz58iybPkRYUPMyz8eRUuEec/
 D3b0fzdZld1gPFSHw2TUDL45w/HFmL24fGbMypSLXuWkLqqD4BjX7u0AFbyd0+po1sSZyMy21
 qDjbqZHyed8CpjL0723bnWdiGC7374rM6JacRaU6DMh0WbG+PxyTXfBUaSM2uE2LjQesi217V
 LYZQrO8ArIH6Q78Exme9GWWqg9EoLLCbLNCcGPyYEx4WdccggWrPx6dJge7d9tRTmzkGzwN64
 246+0KgGMhczXm+h8D8XNjDDFUBeALNdCeh8XzTGrt50UpFtSLh4e+50JXdKpGkk8zEQJktds
 Cgrk0YhLMZNcpf2fiTZWKugSI0wjNyVPwXjX/cFHdarL0n01Lx97OTEwtjruXKGKmVAfDWIpz
 D+B2ZaT1KW6hpdgx/6WPxvl51VaJwZyZiymfKHDasTvpw9wA0soxqMcibtmHWobMtBpghEJoa
 qHH8pPf3/uOt8J31stMAuArirIxrtJOCvZDCSB+g4ybCoLtUb+e7XPF2plsjlkNCp0h+WndV/
 weKppZspJBybO+2TV+fTrGRkzY/s4KgzMLnw3WiNRYmxeG6lmZwxOSao9MEcWwNRnUjfCQ2i6
 LoF/g8E8fOh4yCHY2+QRhdv0g5uSmpYo/OZB4lwnicNvz4+E+k54Vcqa/0Yu9DtartrQKZweT
 S2fh8fLfVcrxfP7lnxmJdQgt6LAS+SBWixgs7juLXkCQsT9pYEm6/ROhjkPlOOE3i2T5ztnGe
 ZiNsq4429dNEBU9oygbXYVExHaF1r2KW1cXQQVXKMhQ+9cagaICDTjISBBxrnw8o9JnYJFb3f
 uBDyIHg7LEldPQg7tuYTBboibjWg5Y4SQ5BTTVwHb9bbM+uAl2p7B4+cKmnx53NkEc183LFnJ
 iT9IK3M1aR7hPf0Hy9CbZY2hkbJh6MN/d5WdtIYnzTg9fF4owEEkogoooAzW3clO1mOLRfHWI
 tk9dRn7qbQBd9iaqXtFCjURQ/CE8SwvueSogzcowFkMpugaSRnTlbz4YPF/iX1XoLb4gdyeZb
 wyNnWoEvLJECXQG+7fD80cnas0U4ghAM3q4gij7ravL7Zf5HZqCbMvLGa4hbTSUDvUlgUs7ET
 YH0pChCm9GhsziuDsyjrvNNStfYNIYpwzTv5fQCijJQ==
Received-SPF: pass client-ip=212.227.15.4;
 envelope-from=michael_heerdegen@HIDDEN; helo=mout.web.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eshel Yaron <me@HIDDEN> writes:

> > (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.

We could additionally support (with-equality-predicate #'equal ...)

> (Accordingly, I tend to "vote" for simply
> changing the semantics to use equal, so no transformation is needed.)

This would be a backward-incompatible change so it's probably not
eligible for voting.


Michael.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#75594: 31.0.50; [FR]: Change equality test for Pcase non-linear patterns
Resent-From: Michael Heerdegen <michael_heerdegen@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 19 Jan 2025 22:37:02 +0000
Resent-Message-ID: <handler.75594.B75594.173732618631904 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 75594
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eshel Yaron <me@HIDDEN>
Cc: 75594 <at> debbugs.gnu.org, monnier@HIDDEN
X-Debbugs-Original-Cc: 75594 <at> debbugs.gnu.org, "Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
Received: via spool by 75594-submit <at> debbugs.gnu.org id=B75594.173732618631904
          (code B ref 75594); Sun, 19 Jan 2025 22:37:02 +0000
Received: (at 75594) by debbugs.gnu.org; 19 Jan 2025 22:36:26 +0000
Received: from localhost ([127.0.0.1]:47717 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tZdu5-0008IU-Pt
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2025 17:36:26 -0500
Received: from mout.web.de ([212.227.15.4]:49613)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael_heerdegen@HIDDEN>)
 id 1tZdtp-0008Hd-HJ
 for 75594 <at> debbugs.gnu.org; Sun, 19 Jan 2025 17:36:10 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de;
 s=s29768273; t=1737326149; x=1737930949;
 i=michael_heerdegen@HIDDEN;
 bh=NXNPD1qzwOfJWkBt0jF/O9Dscrd0VdQdv23iSCQt/zo=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=JsS8iuowm+xTQ9ACUyT5da7M6mMlVL28x/lVUborgW8PaVgtSkZlk2h0gj9UMXDc
 9A/UIjqig53FPykm6XtrCGCTlw3IpuqGwnxjVX3WLTC8eX3Ikv4i+BIZVeIT4vWlg
 yxFCJyq8Gv82e5B1jItuRoqVxbW0oOjU80uOWrkG4Zcv817uNWG1qALhnaNh1+Sxa
 NYYw+BDbYOEFvIzOwbCyNmNMMdIbjc4wdVNrCnaf+yOdI8ZjeypTaMT7+WXPOGqy5
 HbgBJ4zXcfp0gS+rTZNZHTP5yESTKyksiDeovWhZLBlvG66KnAgU6NVfGyv2Qzr9a
 tQnzIJGHM1+Jw6pKug==
X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6
Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb005
 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MmQcf-1t94eS3All-00mfx8; Sun, 19
 Jan 2025 23:35:49 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
In-Reply-To: <m1tt9vdzt2.fsf@HIDDEN> (Eshel Yaron's message of "Sun, 
 19 Jan 2025 08:32:09 +0100")
References: <m14j1z6daa.fsf@HIDDEN>
 <jwv8qrb61gd.fsf-monnier+emacs@HIDDEN>
 <m1h65z45hc.fsf@HIDDEN> <87wmeui77o.fsf@HIDDEN>
 <87sephhwbp.fsf@HIDDEN> <m1tt9vdzt2.fsf@HIDDEN>
Date: Sun, 19 Jan 2025 23:37:05 +0100
Message-ID: <87cygiv3am.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:Kz3ztAoZG6OZTiYDpdhXzFPuf1we4TR9QleHxlcPGvJSzSTM7Kq
 9zF4DCIu+r3T28+XGvWXVBXONCOj5AU82NsKYJZ4Dvy1D4KPrOfc3krlQvBtM28gVeIhp3B
 uoUm+Ieqajh5skisJE8qymLOYkR9qbKlt8AaEpA/+YP5hPDPJIfM3Vc4Wq6HD7ryP0yZGLR
 FU3zvBd1qrMJdUNXEEUBg==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:+tocg1DW3iA=;6JJoVkjZVsPoDkl5vH4C5n6JCsB
 9vRBP+BYB/o7sekY1Xve+bC61CnKXgvh6FF/nMf5OPRAmXWvOz58iybPkRYUPMyz8eRUuEec/
 D3b0fzdZld1gPFSHw2TUDL45w/HFmL24fGbMypSLXuWkLqqD4BjX7u0AFbyd0+po1sSZyMy21
 qDjbqZHyed8CpjL0723bnWdiGC7374rM6JacRaU6DMh0WbG+PxyTXfBUaSM2uE2LjQesi217V
 LYZQrO8ArIH6Q78Exme9GWWqg9EoLLCbLNCcGPyYEx4WdccggWrPx6dJge7d9tRTmzkGzwN64
 246+0KgGMhczXm+h8D8XNjDDFUBeALNdCeh8XzTGrt50UpFtSLh4e+50JXdKpGkk8zEQJktds
 Cgrk0YhLMZNcpf2fiTZWKugSI0wjNyVPwXjX/cFHdarL0n01Lx97OTEwtjruXKGKmVAfDWIpz
 D+B2ZaT1KW6hpdgx/6WPxvl51VaJwZyZiymfKHDasTvpw9wA0soxqMcibtmHWobMtBpghEJoa
 qHH8pPf3/uOt8J31stMAuArirIxrtJOCvZDCSB+g4ybCoLtUb+e7XPF2plsjlkNCp0h+WndV/
 weKppZspJBybO+2TV+fTrGRkzY/s4KgzMLnw3WiNRYmxeG6lmZwxOSao9MEcWwNRnUjfCQ2i6
 LoF/g8E8fOh4yCHY2+QRhdv0g5uSmpYo/OZB4lwnicNvz4+E+k54Vcqa/0Yu9DtartrQKZweT
 S2fh8fLfVcrxfP7lnxmJdQgt6LAS+SBWixgs7juLXkCQsT9pYEm6/ROhjkPlOOE3i2T5ztnGe
 ZiNsq4429dNEBU9oygbXYVExHaF1r2KW1cXQQVXKMhQ+9cagaICDTjISBBxrnw8o9JnYJFb3f
 uBDyIHg7LEldPQg7tuYTBboibjWg5Y4SQ5BTTVwHb9bbM+uAl2p7B4+cKmnx53NkEc183LFnJ
 iT9IK3M1aR7hPf0Hy9CbZY2hkbJh6MN/d5WdtIYnzTg9fF4owEEkogoooAzW3clO1mOLRfHWI
 tk9dRn7qbQBd9iaqXtFCjURQ/CE8SwvueSogzcowFkMpugaSRnTlbz4YPF/iX1XoLb4gdyeZb
 wyNnWoEvLJECXQG+7fD80cnas0U4ghAM3q4gij7ravL7Zf5HZqCbMvLGa4hbTSUDvUlgUs7ET
 YH0pChCm9GhsziuDsyjrvNNStfYNIYpwzTv5fQCijJQ==
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eshel Yaron <me@HIDDEN> writes:

> > (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.

We could additionally support (with-equality-predicate #'equal ...)

> (Accordingly, I tend to "vote" for simply
> changing the semantics to use equal, so no transformation is needed.)

This would be a backward-incompatible change so it's probably not
eligible for voting.


Michael.




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 21 Jan 2025 02:26:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 21:26:52 2025
Received: from localhost ([127.0.0.1]:52628 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ta3ye-0004S4-G0
	for submit <at> debbugs.gnu.org; Mon, 20 Jan 2025 21:26:52 -0500
Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:53580)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1ta3yb-0004RZ-Bu
 for control <at> debbugs.gnu.org; Mon, 20 Jan 2025 21:26:49 -0500
Received: by mail-ed1-x535.google.com with SMTP id
 4fb4d7f45d1cf-5da12292b67so8201525a12.3
 for <control <at> debbugs.gnu.org>; Mon, 20 Jan 2025 18:26:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1737426403; x=1738031203; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=NwTogFj/g9szdkqGwXk/IVMzNnEZuayCPwDqsVcpHB4=;
 b=KH35c9rtOl9Iltt+obIHXFZPztaaAhW2hOPSw54agcZ/idZPE+pr5Hf6RtjU7jZVQZ
 HDkeKVm1mzR/yTWJIt54QMvN2orOiUD7hNc679W2XzFT6ccG51sxOMvvCuCVCTBjZSy/
 wB9ftLiBMMX72/3aIjIu8q5M1Ga6d6SWr+wJiPx61WXErjYSQorfnT4RG4Itcd0tjdbl
 r3PEUxhTQZICrt3YkBqGb+jftVD/guaxxa9JAk+6amRx8YigByJDSPdQZ5hacKrxr9pV
 AqcMqvdFHXyojzzth6M6Var+iZkMMDj2HkzoT5i9+0NbDIW5ckAUv3XMY7iTj+EQKM9C
 Pz1g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1737426403; x=1738031203;
 h=to:subject:message-id:date:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=NwTogFj/g9szdkqGwXk/IVMzNnEZuayCPwDqsVcpHB4=;
 b=L72HB083h1rOEHydlRTpGhT1upQAuYSdbfmS6yxfYVtWjx41jTOPioCl5HQtBdrIPs
 02QzVXaf/UTogGlmxA4DcmCTwu3ZNi4W247NuwEqsOpZ+IdgqPSWMF+eL18q8VEhOX1i
 maxaDGYhiRvquJRgpKSucXXhTfQ1kJHGpyKkWZLN0c76ohbMrC9upjxFybS/KWDuPH8n
 Y0O1i5cvdONYgD+VSTYThbrTTwk0SudVL8ml9bHEWMXkEwCKwkcXTelCggufyRyMIUW7
 ehvzwSFvaz/qlIDqh9/sqO5qqF8RLuQDc/606N8OjonW2fe2kOOrlSdHKqmT2xkI9L1r
 eajw==
X-Gm-Message-State: AOJu0YzaiuHXbBF4TdD+uPaIbus084NsNx9piOrnL/rXd9TYtScx66au
 e89TuGYT+ytyn6lM6hDMeBEXzWEAIP0EbLv7c8gziT7Cuqp0b9nZhosgJ8x0T6pB2ByiuKjVuIC
 qyK/KJB++xOGuoeuQIK9287l4xlEwJW1X
X-Gm-Gg: ASbGncu31XKuKhMd8ryDEH7WdMVWuo21vdgyjit5P9JtIoVP0V6zQvUCdL6yEUBmsta
 KOuXba/2bcOQvhAPae3wFp2U9dXi9FEGjZ4w/o1AAGdIiR/Hp5rl3Ww==
X-Google-Smtp-Source: AGHT+IGhC+v7tN37HazeM3EmomOo1ywDoWYJQ+kXfaoFgMLrGBNwqApGp91YJZfhTtXIN03dn2Dlz7cFstZcsHsV1ks=
X-Received: by 2002:a05:6402:2109:b0:5d0:e73c:b7f0 with SMTP id
 4fb4d7f45d1cf-5db7db2a0fbmr38516588a12.28.1737426403179; Mon, 20 Jan 2025
 18:26:43 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Mon, 20 Jan 2025 18:26:42 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
MIME-Version: 1.0
Date: Mon, 20 Jan 2025 18:26:42 -0800
X-Gm-Features: AbW1kvZViXss0auFsLClrQ2Xf0jGwzM8lRz7l7CnlcDfTSP7x8_YxkmIkmOdwhw
Message-ID: <CADwFkm=Luf-6g0QEqw5bzxNQfnkPt5ZcmF4pH=4UPCXLYvVfFg@HIDDEN>
Subject: control message for bug #75594
To: control <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

severity 75594 wishlist
quit





Last modified: Tue, 21 Jan 2025 02:30:02 UTC

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