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: Mon, 04 Dec 2023 14:08:14 -0500
Message-ID: <jwvplzllrrm.fsf-monnier+emacs@gnu.org>
References: <277dd49a-e96d-4faf-a22e-aca952354a37@protonmail.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="23562"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cc: 67611@debbugs.gnu.org
To: Okamsn <okamsn@protonmail.com>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 04 20:09:12 2023
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 1rAEJb-0005tK-QK
	for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Dec 2023 20:09:12 +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 1rAEJJ-0005U3-5L; Mon, 04 Dec 2023 14:08:53 -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 1rAEJI-0005Tg-0t
 for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 14:08:52 -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 1rAEJH-0003sa-PL
 for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 14:08:51 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rAEJS-0007mN-3S
 for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 14:09:02 -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: Mon, 04 Dec 2023 19:09:02 +0000
Resent-Message-ID: <handler.67611.B.170171693729885@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 67611
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org
Original-Received: via spool by submit@debbugs.gnu.org id=B.170171693729885
 (code B ref -1); Mon, 04 Dec 2023 19:09:02 +0000
Original-Received: (at submit) by debbugs.gnu.org; 4 Dec 2023 19:08:57 +0000
Original-Received: from localhost ([127.0.0.1]:35704 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1rAEJN-0007lw-4a
 for submit@debbugs.gnu.org; Mon, 04 Dec 2023 14:08:57 -0500
Original-Received: from lists.gnu.org ([2001:470:142::17]:54538)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@iro.umontreal.ca>) id 1rAEJL-0007lg-CI
 for submit@debbugs.gnu.org; Mon, 04 Dec 2023 14:08:55 -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 <monnier@iro.umontreal.ca>)
 id 1rAEJ4-0005TG-Lr
 for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 14:08:38 -0500
Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <monnier@iro.umontreal.ca>)
 id 1rAEJ2-0003rZ-M8
 for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 14:08:38 -0500
Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3444D80663;
 Mon,  4 Dec 2023 14:08:34 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1701716913;
 bh=tKLG98ieavJe194H1P4n8IRoIpQKDc69IUD8Q3db34o=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Tk9NPd02Flpa25pa66gO7B/r9wLTI/gLxaslytE6eV+tnUG/UoD5Gq+3ak1no2klU
 D4k92H5OwF4hTIGEf5d5qURTjYO8vp0fOiqtYN2BRErUq6JfH8kZEMGzRwAwhjtS6Z
 NqMgGkZThoESHe7tFr7vTz7B7YBPBGpFgao26Md1qcb9tPKG5IHEiF26jlUgSwWBPA
 DhpwIfVWL1PmGrrHTwrFCCFJ77vXoomVha2qbjchciOdsxTU9xUQVgTEl9fhIJWWCG
 w4+SJRBfuZ/1GkReXWiMR6YQoliqSRs9Io0EeTmcV/P2xF6Qz9wKQxSLg5byXJMZiA
 XAyMqz2Ayfx0Q==
Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 76BC480091;
 Mon,  4 Dec 2023 14:08:33 -0500 (EST)
Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 688FC120210;
 Mon,  4 Dec 2023 14:08:33 -0500 (EST)
In-Reply-To: <277dd49a-e96d-4faf-a22e-aca952354a37@protonmail.com>
 (okamsn@protonmail.com's message of "Sun, 03 Dec 2023 20:33:35 +0000")
Received-SPF: pass client-ip=132.204.25.50;
 envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca
X-Spam_score_int: -42
X-Spam_score: -4.3
X-Spam_bar: ----
X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
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:275528
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/275528>

> The attached patch adds the pattern `cl-lambda` for Pcase, which works
> like `cl-destructuring-bind`. There are two differences with the lambda
> lists:

Hmm... I'm not sure mixing the CL destructuring patterns with the Pcase
patterns (both of which are rather featureful and complex) will help
their popularity.

Beside that problem (which means I'm not very favorable to the
addition), the name should be changed because "lambda" is misleading.
It suggests this has to do with a function (I had to read the code to
understand what this is doing).

> The pattern is useful when one wants to combine the features of `pcase`
> and `cl-destructuring-bind`, such combining the optional values with the
> `pred` or `guard` patterns.

Do you have examples uses?

Maybe we could introduce a different Pcase pattern which covers those
needs but stays closer to the Pcase pattern syntax?


        Stefan