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 Kangas <stefankangas@gmail.com>
Cc: Okamsn <okamsn@protonmail.com>,
	67611@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind`
Date: Thu, 11 Jan 2024 22:46:01 +0000	[thread overview]
Message-ID: <CALDnm528OQYfensjv41CqOBV5c7FjJih7t9X2gXb5Q2zz6amwg@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmnKonoweYJYjeWsrGnFjCvWUs7DoFdrDqAti=SMk8m44Q@mail.gmail.com>

On Thu, Jan 11, 2024 at 10:13 PM Stefan Kangas <stefankangas@gmail.com> wrote:
>
> João Távora <joaotavora@gmail.com> writes:
>
> > On Thu, Jan 11, 2024 at 9:12 PM Stefan Kangas <stefankangas@gmail.com> wrote:
> >
> >> Thanks for the patch.  I can only echo the sentiment already given here,
> >> that making `pcase' more complex won't do much for its popularity.
> >
> > This sentiment is not unanimous.  If pcase is naturally extensible,
> > using that ability is not making it more complex.  That'd be akin
> > to saying "defun" is made more complex because too many functions
> > are popping up.
> >
> > Just wanted register this position. Though I don't know for sure if
> > the patch is simply adding a new extension to pcase or changing
> > its core structure.
> >
> > I wish Okamsn would show one or two simple examples usage
> > of something you can't do with pcase today, but you would be
> > able to with the patch.

In the meantime, I've had a look at the patch file to learn
about this pcase extension.

1. It is a pure extension.  The extension code happens in cl-macs.el

2. It is an alternative to cl-destructuring-bind, also defined
   in that file, with more typing involved.

3. It _seems_ it has the advantage that it relies on very little
   of cl-macs.el, like maybe just cl-copy-list.  Ie it could easily
   be changed to live in another file.  It could  even be a (better?)
   base to write cl-destructuring-bind and other cl-macs things on top
   of.  And to write other utils like Alexandria's
   cl-parse-ordinary-lambda-list or destructuring-case [1].

   A good lambda-list destructuring tool is valuable by itself, even
   without pcase integration.

4. Pcase integration is a "nice to have".  In the provided tests, the
   new extension is only tested as a destructuring aid, so I cannot tell
   very well how it fares int the matching aspect of pcase.  For example
   I did this experiment:

   (pcase (list 42 41 :c 42)
     ((cl-arglist (42 42 &key c))
      (list c))
     ((cl-arglist (42 b &rest more))
      (list b more)))

   This matches the second case, which is good and returns (41 (:c 42))

   But how do I construct a case that matches only if the provided
   value to c is 42, if this is at all possible?

> feel free to reopen the bug report if you think it makes sense.

I think it makes sense, but I don't know how to do that.  Just write
reopen 67611/thanks to this tracker?

João

[1]: https://gitlab.common-lisp.net/alexandria/alexandria





  reply	other threads:[~2024-01-11 22: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 [this message]
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
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=CALDnm528OQYfensjv41CqOBV5c7FjJih7t9X2gXb5Q2zz6amwg@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.