From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= <joaotavora@gmail.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Tue, 5 Dec 2023 09:26:58 +0000
Message-ID: <CALDnm513hT_txSau0+mjqRp4T++K=C7YbF2oWUF9t=wurx171Q@mail.gmail.com>
References: <277dd49a-e96d-4faf-a22e-aca952354a37@protonmail.com>
 <jwvplzllrrm.fsf-monnier+emacs@gnu.org>
 <56ebae03-a94d-4379-bd08-66bde2311bb7@protonmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="610"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: 67611@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
To: Okamsn <okamsn@protonmail.com>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 05 10:28:07 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 1rARip-000ATN-3Q
	for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Dec 2023 10:28:07 +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 1rARif-0000cX-CM; Tue, 05 Dec 2023 04:27:57 -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 1rARiZ-0000cA-3A
 for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2023 04:27: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 1rARiY-00069D-RM
 for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2023 04:27:50 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rARij-0002sL-Rm
 for bug-gnu-emacs@gnu.org; Tue, 05 Dec 2023 04:28:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?=
 <joaotavora@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Tue, 05 Dec 2023 09:28:01 +0000
Resent-Message-ID: <handler.67611.B67611.170176844911000@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
Original-Received: via spool by 67611-submit@debbugs.gnu.org id=B67611.170176844911000
 (code B ref 67611); Tue, 05 Dec 2023 09:28:01 +0000
Original-Received: (at 67611) by debbugs.gnu.org; 5 Dec 2023 09:27:29 +0000
Original-Received: from localhost ([127.0.0.1]:36637 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1rARiD-0002rM-92
 for submit@debbugs.gnu.org; Tue, 05 Dec 2023 04:27:29 -0500
Original-Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:50661)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <joaotavora@gmail.com>) id 1rARiA-0002r8-OJ
 for 67611@debbugs.gnu.org; Tue, 05 Dec 2023 04:27:27 -0500
Original-Received: by mail-lf1-x12a.google.com with SMTP id
 2adb3069b0e04-50bfe99b6edso1523487e87.1
 for <67611@debbugs.gnu.org>; Tue, 05 Dec 2023 01:27:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1701768430; x=1702373230; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:from:to:cc:subject:date
 :message-id:reply-to;
 bh=s7tV9wJSs6AZ49KWyX7b6XWERlciLouG8uV+BYndsfM=;
 b=cR7LJ0/mUWF7U+wDCK1nRHj2bxvz84fldidMg00w8vGZQ3kZKOAIfDMHJIrCoarkMe
 1hObqCp3qm6wUqPbshkbKEdTqJHxcnAgODEITO1eJKRA4Gh1Vo7+Lz71F/q0Bq56BdGN
 jzWQqz2X7tSUrvcZXfj6icHJ6Q75i/vx5IGWvMp0UGb5ayJKdz5F6UWv5t2ezTZV3pQG
 W8qppU/dNrp/zqKXMjd5C3AajzAPNC5hTo6BvLvtZDEdAwG+fTRaLHaMwBp4B4vw5q6K
 Lzucz/MNCWuLn9R1dfth2+1v1PxVXfLPUPIIe/qld2ZYWvPIa6YcW1aiwslocFrUOpSc
 J3Dw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1701768430; x=1702373230;
 h=content-transfer-encoding:cc:to:subject:message-id:date:from
 :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=s7tV9wJSs6AZ49KWyX7b6XWERlciLouG8uV+BYndsfM=;
 b=mtqG8RhxF40roBdGJwAE/xCsyOQ3NvTFcaP2n9g8kYzfbBdLsxDgmPOmAd7bpLGnwa
 2DvNIhcBK/zpyzzQioCjRHfTagiJJLBzgkT79aR+RRavMFXO6crwX/UNggkJlsbVh87X
 0w8+wKddAgi+ZrsIO4YiIHZSkp4KYJmqu7nSi0mPkqbPxQqR/NXjqKzkLJDYFDPpCuaz
 pp7XytJhdek6i4oyE80r/3TKVUKocZWsHtrz9L5WPajlDqqZs84AFEd6raUvDf0NS2xu
 CrCRA2/MXc2zWzjiVdc4ssZ/NuUC6oZZsSg/y6HS9o/MGqCGH4549r923s73X3diuKTz
 ebuQ==
X-Gm-Message-State: AOJu0YzDU2ZXS3VpMYeeNk9TmGrcwdYiT4K4QKNGjGIdCUBH9VlOF02S
 e8h+nY8Tslk+aAgYVZYMKi5hknjfMppX9f6AjLB+MqJY2Y4=
X-Google-Smtp-Source: AGHT+IELW38zTzyTbYXUzERwnCEHw3INUBaxZtBl/yzvXauMKz0UPjhRrzjCHd3PIoBi6AH8r85gi7AIE+WluBVFHg4=
X-Received: by 2002:ac2:4e51:0:b0:50b:fa93:35c9 with SMTP id
 f17-20020ac24e51000000b0050bfa9335c9mr957733lfr.113.1701768429612; Tue, 05
 Dec 2023 01:27:09 -0800 (PST)
In-Reply-To: <56ebae03-a94d-4379-bd08-66bde2311bb7@protonmail.com>
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:275561
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/275561>

On Tue, Dec 5, 2023 at 2:43=E2=80=AFAM Okamsn via Bug reports for GNU Emacs=
,
the Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:

> For me, I am interested in using such a destructuring pattern with
> `pcase-let` and `pcase-setq`, but not so much with `pcase` itself.
>
> > Maybe we could introduce a different Pcase pattern which covers those
> > needs but stays closer to the Pcase pattern syntax?
>
> As far as I understand Pcase, one thing that I think cl-lib does better
> is specifying default values for multiple optional variables. For
> example, for `(a &optional (b 2) (c 3))` in Pcase, I would write

Yes.  cl-lib has a couple of neat tricks up its sleeve, still.

And what about keyword arguments in plists? Can pcase
destructure them?  If so, does it bind the "supplied-p" variable?
And can it rename the variable being destructured to something
else non-clashing?

All these things are useful in CL's destructuring-bind,
but it is missing other stuff like "casing" logic.  So
at least on a first glimpse, this reunion would be
welcome by me.

With the caveat that I haven't seen any examples or the
patch yet, and it matters.

Jo=C3=A3o