From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Stefan Monnier via "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Fri, 12 Jan 2024 10:38:50 -0500
Message-ID: <jwvle8uefqj.fsf-monnier+emacs@gnu.org>
References: <277dd49a-e96d-4faf-a22e-aca952354a37@protonmail.com>
 <jwvplzllrrm.fsf-monnier+emacs@gnu.org>
 <30f1bf76-1cf1-493e-be4f-38e405d0ecf6@protonmail.com>
 <CADwFkm=7bc5__WNzZftWt01cnQt4NpnFez+LmqJo9qnieN2nCQ@mail.gmail.com>
 <CALDnm51VjpjCp4xLPfQ-qR1iwxdDc5XX0i3=8M1vW6vUDizMTw@mail.gmail.com>
 <jwvwmsfntmc.fsf-monnier+emacs@gnu.org>
 <CALDnm52=voD5PrnsU58wQR1omwymYdUALEAueqsQTZujU6i0rQ@mail.gmail.com>
Reply-To: Stefan Monnier <monnier@iro.umontreal.ca>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="7910"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cc: Okamsn <okamsn@protonmail.com>, 67611@debbugs.gnu.org,
 Stefan Kangas <stefankangas@gmail.com>
To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@gmail.com>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 12 16:39:23 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1rOJcx-0001oV-Ea
	for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Jan 2024 16:39:23 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1rOJcj-0001Sy-OG; Fri, 12 Jan 2024 10:39:09 -0500
Original-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 <Debian-debbugs@debbugs.gnu.org>)
 id 1rOJcf-0001SY-NB
 for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2024 10:39:05 -0500
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1rOJcf-0003hM-87
 for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2024 10:39:05 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rOJcb-0004vu-TF
 for bug-gnu-emacs@gnu.org; Fri, 12 Jan 2024 10:39:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Stefan Monnier <monnier@iro.umontreal.ca>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Fri, 12 Jan 2024 15:39:01 +0000
Resent-Message-ID: <handler.67611.B67611.170507394018954@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 67611
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: wontfix notabug patch
Original-Received: via spool by 67611-submit@debbugs.gnu.org id=B67611.170507394018954
 (code B ref 67611); Fri, 12 Jan 2024 15:39:01 +0000
Original-Received: (at 67611) by debbugs.gnu.org; 12 Jan 2024 15:39:00 +0000
Original-Received: from localhost ([127.0.0.1]:37257 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1rOJca-0004ve-20
 for submit@debbugs.gnu.org; Fri, 12 Jan 2024 10:39:00 -0500
Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:42135)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@iro.umontreal.ca>) id 1rOJcX-0004vO-Ss
 for 67611@debbugs.gnu.org; Fri, 12 Jan 2024 10:38:58 -0500
Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2E096812A8;
 Fri, 12 Jan 2024 10:38:53 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1705073931;
 bh=+Z9JrBLYb1WjUQoqDN034Hcz/BiH6oQCofQ7kwuuq4s=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=cleuaBkCoMGdO/nIeGA3dBOKjQ/IV8DS4LBHOy6JiOCtHm9O321/jTAPWbfAw97ME
 PiOAXmyy2Z60t3MqvoNHiHilnncX7vjwJ/I+GUzUSei0m4b7H1vMVJf3Q9Tca0cj4Q
 kB+Za001210LpqaRK7bRM8vJr95VXD4Za5/GRJnx8TttiwU40onwqy9mVf6A0ljLLw
 tMN5ibC+ppMn3SN6DV/Ahw4E0mfV+vbGlJTCsrXUzI+OIO5gVpLY0M+xkcWmYOyMQT
 YTQdFG745j00Wcsx70uD6dWpCAvOcAc+UjFmFA3OQ5CLXTaF27nVkcosl3oMvaYjQV
 eI5b0K9J1w1qw==
Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C2F83800D0;
 Fri, 12 Jan 2024 10:38:51 -0500 (EST)
Original-Received: from alfajor (unknown [23.233.149.155])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 92FE2120BA0;
 Fri, 12 Jan 2024 10:38:51 -0500 (EST)
In-Reply-To: <CALDnm52=voD5PrnsU58wQR1omwymYdUALEAueqsQTZujU6i0rQ@mail.gmail.com>
 ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Fri,
 12 Jan 2024 10:46:43 +0000")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:278041
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/278041>

>> I don't think there's a clear enough need for it right now in Emacs core
>> to motivate its integration in Emacs proper.  Also, because several
>> people have expressed an opinion that leans towards recommending that
>> Emacs's own code should probably better avoid using this functionality.
> Those people are trying to come up with alternative pattern-matching
> libraries which we start to see are not simpler or as powerful
> as pcase.

Only some of them are.  Others are perfectly happy with using `pcase`
but still aren't super happy about combining the complexity of `pcase`
with that of CL destructuring syntax.

Personally I'm rather put off by the difficulty of figuring out which
part is using CL syntax and which part is using Pcase: the transition
from Pcase to CL is fairly clear (marked by `cl-arglist` or somesuch),
but the other is much less so.

I'd be happier with a `cl-arglist` which cannot contain nested Pcase
patterns (i.e. a one-way street from Pcase to CL) with
`cl-destructuring-bind` reimplemented on top of it.

I'd also be interested in a new Pcase pattern that provides the part of
`cl-arglist` functionality that's missing from current Pcase patterns
(like "optional" elements in a list), but with a syntax that blends
better in Pcase patterns.

> IOW there is no general purpose-util like Alexandria's
> 'parse-ordinary-lambda-list', and this could be it.  It could
> not only be used to simplify and add coherence to many of these
> existing compile-time structures, for example helping simplify
> things and address FIXMEs in cl-lib.el.

That's a different question: improving up cl-lib's implementation would
be welcome, yes.  That's not what the current patch does, tho.


        Stefan