all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Okamsn <okamsn@protonmail.com>,
	67611@debbugs.gnu.org, Stefan Kangas <stefankangas@gmail.com>
Subject: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind`
Date: Fri, 12 Jan 2024 10:46:43 +0000	[thread overview]
Message-ID: <CALDnm52=voD5PrnsU58wQR1omwymYdUALEAueqsQTZujU6i0rQ@mail.gmail.com> (raw)
In-Reply-To: <jwvwmsfntmc.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]

On Fri, Jan 12, 2024 at 3:05 AM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

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

But sure, other pattern-matching libraries exist out there.  See
CL's optima/trivia [1/2] for some very good ones.  Emacs just happens
to have pcase readily available.

> I'd be quite happy to include such a think in GNU ELPA, OTOH.

Could be, but why really?  Why are CL things which rest on such
high-quality well-known designs, older than many things Emacs,
relegated to a place where they're less discoverable?

Here, I think at least the new fresh implementation of
lambda-list parsing (which is the meat-and-bones of this patch)
is worth taking a look at.

It's the function 'cl--pcase-cl-lambda-var-groups'.

I would definitely consider grooming this function, renaming
it, and keeping it in core, exposing to general Elisp usage
in cl-macs.el (or cl-lambdalist.el, cl-ll.el), even if a new
pcase pattern that uses it goes to ELPA (but why, really?)

That util could help us write other lambda-list destructuring
alternatives that understand &optional, &rest.  Because with or
without it, we already use a lot of the &optional, &rest explicitly
in Emacs.  And we also use &key and &allow-other-keys in many other
places, though sometimes in ad-hoc lets-not-call-this-bull-by-its-name
fashion.

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.

João

[1] https://github.com/m2ym/optima
[2] https://github.com/guicho271828/trivia

[-- Attachment #2: Type: text/html, Size: 2723 bytes --]

  reply	other threads:[~2024-01-12 10:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 20:33 bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-04 19:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-05  2:42   ` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-05  9:26     ` João Távora
2023-12-05  9:21   ` João Távora
2023-12-25 21:30   ` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-11 21:12     ` Stefan Kangas
2024-01-11 21:56       ` João Távora
2024-01-11 22:13         ` Stefan Kangas
2024-01-11 22:46           ` João Távora
2024-01-12  0:55             ` Okamsn via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-13  6:38             ` Stefan Kangas
2024-01-12  3:04         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 10:46           ` João Távora [this message]
2024-01-12 15:38             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 16:56               ` João Távora
2024-01-13  6:58                 ` Stefan Kangas
2024-01-14  3:08               ` Richard Stallman
2024-01-14  3:12                 ` João Távora
2024-01-17  3:29                   ` Richard Stallman
2024-01-17  9:12                     ` João Távora
2024-02-08  3:49                       ` Richard Stallman
2024-02-08 13:41                         ` João Távora
2024-02-11  3:28                           ` Richard Stallman
2024-02-12 15:25                             ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALDnm52=voD5PrnsU58wQR1omwymYdUALEAueqsQTZujU6i0rQ@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=67611@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=okamsn@protonmail.com \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.