[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-des
From: |
João Távora |
Subject: |
bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind` |
Date: |
Tue, 5 Dec 2023 09:26:58 +0000 |
On Tue, Dec 5, 2023 at 2:43 AM 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ão