GNU bug report logs - #67611
[PATCH] Add a Pcase pattern `cl-lambda` equivalent to `cl-destructuring-bind`

Previous Next

Package: emacs;

Reported by: Okamsn <okamsn <at> protonmail.com>

Date: Sun, 3 Dec 2023 20:35:01 UTC

Severity: wishlist

Tags: patch

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67611 in the body.
You can then email your comments to 67611 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Sun, 03 Dec 2023 20:35:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Okamsn <okamsn <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 03 Dec 2023 20:35:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Okamsn <okamsn <at> protonmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Sun, 03 Dec 2023 20:33:35 +0000
[Message part 1 (text/plain, inline)]
Hello,

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

1. It does not support `&environment`
2. Without `&allow-other-keys` or `:allow-other-keys t`, the pattern 
will fail to match if their are unmatched keys in EXPVAL, but it does 
not throw an error.

The variable that would be bound in the lambda list can be Pcase 
patterns themselves, with two exceptions:

1. Using a sub-pattern as the cdr of a dotted list, like "(cl-lambda (a 
. `(,b . ,c))" doesn't work, since the pattern won't always look like a 
dotted list.
2. For constructs that use a sub-list to provide additional values, such 
as `&optional`, `&key`, and `&aux`, the sub-pattern only works inside 
the sub-list.  For example, one could do "(cl-lambda (&optional (`(,a 
,b))" but not "(cl-lambda (&optional `(,a ,b)))".

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.

Thank you.
[0001-Add-the-Pcase-pattern-cl-lambda-for-matching-lambda-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Mon, 04 Dec 2023 19:09:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Okamsn <okamsn <at> protonmail.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Mon, 04 Dec 2023 14:08:14 -0500
> 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Tue, 05 Dec 2023 02:43:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Okamsn <okamsn <at> protonmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Tue, 05 Dec 2023 02:42:12 +0000
Stefan Monnier wrote:
>> 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).

I agree that the name is not ideal. When I searched for what the 
destructuring pattern was called, the website Common Lisp HyperSpec 
called it a "destructuring lambda list" 
(https://www.lispworks.com/documentation/HyperSpec/Body/03_de.htm). I 
would have suggested "cl", as it is the kind of destructuring used by 
the macros of cl-lib, but I thought that would not work well with the 
existence of the "cl-type" pattern. I also thought about something like 
"cl-arglist", if that is better.

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

Not of that idea, no.  I maintain a library that implements a 
destructuring pattern like cl-lib 
(https://github.com/okamsn/loopy/blob/master/doc/loopy-doc.org#basic-destructuring) 
and I have been thinking about how I could use Pcase to simplify the 
implementation of the destructuring and to stop using a re-invented 
wheel. While doing that, it occurred to me that cl-lib itself might be a 
better place for such a Pcase pattern. To be clear, the patch only 
implements the cl-lib destructuring, not the other destructuring ideas 
from my library.

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

     (or `(,a ,b ,c)
         (and `(,a ,b)
              (let c 3))
         (and `(,a)
              (let c 3)
              (let b 2)))

or

     `(,a . ,(or `(,b . ,(or `(,c)
                             (let c 3)))
                 (and (let b 2)
                      (let c 3))))

in which there is repetition in the default values. Is there a better 
way to specify default values for optional elements?

Thank you.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Tue, 05 Dec 2023 09:23:02 GMT) Full text and rfc822 format available.

Message #14 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Tue, 5 Dec 2023 09:21:47 +0000
On Mon, Dec 4, 2023 at 7:09 PM Stefan Monnier via Bug reports for GNU
Emacs, the Swiss army knife of text editors <bug-gnu-emacs <at> gnu.org>
wrote:
>
> > 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?

I for one would like to see some examples too.  Okamsn's description
of this pcase extension sounds interesting.  In fact, it sounds very
much like the slime-dcase and sly-dcase macros in SLIME and SLY
respectively.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Tue, 05 Dec 2023 09:28:01 GMT) Full text and rfc822 format available.

Message #17 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Okamsn <okamsn <at> protonmail.com>
Cc: 67611 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: 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 <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Mon, 25 Dec 2023 21:32:02 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Okamsn <okamsn <at> protonmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: bug-gnu-emacs <at> gnu.org,
 João Távora <joaotavora <at> gmail.com>
Subject: Re: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Mon, 25 Dec 2023 21:30:07 +0000
[Message part 1 (text/plain, inline)]
Stefan Monnier wrote:
>> 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
> 

Hello,

Because I wrote this patch with the thought that others might want it, I 
don't have any nontrivial examples to share right now. The best example 
I have for the use of the optional arguments is for the implementing of 
the optional arguments, which isn't very convincing.

I've updated the patch to rename the pattern to `cl-arglist` and to 
avoid creating intermediate variables using the `let` pattern, but I'm 
fine with resting the discussion here until a stronger argument can be 
made in favor of the patch.

Thank you.
[v2-0001-Add-the-Pcase-pattern-cl-arglist-for-matching-a-C.patch (text/x-patch, attachment)]

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 27 Dec 2023 21:52:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Thu, 11 Jan 2024 21:13:01 GMT) Full text and rfc822 format available.

Message #25 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Okamsn <okamsn <at> protonmail.com>
Cc: 67611 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 joaotavora <at> gmail.com
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Thu, 11 Jan 2024 13:12:43 -0800
severity 67611 wishlist
tags 67611 + notabug wontfix
close 67611
thanks

Okamsn <okamsn <at> protonmail.com> writes:

> Hello,
>
> Because I wrote this patch with the thought that others might want it, I
> don't have any nontrivial examples to share right now. The best example
> I have for the use of the optional arguments is for the implementing of
> the optional arguments, which isn't very convincing.
>
> I've updated the patch to rename the pattern to `cl-arglist` and to
> avoid creating intermediate variables using the `let` pattern, but I'm
> fine with resting the discussion here until a stronger argument can be
> made in favor of the patch.
>
> Thank you.

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.

It sounds like we mostly agree that no change should be made here, at
least not for the moment, so I'm inclined to close this one as wontfix.
It's always awkward to have to say no to a well-reasoned patch, but
sometimes a decision has to be made.  I hope you can understand, and
apologies for not accepting your patch.  I'm closing the bug with this
message.

Thank you again for contributing.




Added tag(s) notabug and wontfix. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 11 Jan 2024 21:13:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 67611 <at> debbugs.gnu.org and Okamsn <okamsn <at> protonmail.com> Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 11 Jan 2024 21:13:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Thu, 11 Jan 2024 21:57:02 GMT) Full text and rfc822 format available.

Message #32 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Thu, 11 Jan 2024 21:56:06 +0000
On Thu, Jan 11, 2024 at 9:12 PM Stefan Kangas <stefankangas <at> 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.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Thu, 11 Jan 2024 22:14:02 GMT) Full text and rfc822 format available.

Message #35 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Thu, 11 Jan 2024 14:13:24 -0800
João Távora <joaotavora <at> gmail.com> writes:

> On Thu, Jan 11, 2024 at 9:12 PM Stefan Kangas <stefankangas <at> 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.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Thu, 11 Jan 2024 22:47:02 GMT) Full text and rfc822 format available.

Message #38 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Thu, 11 Jan 2024 22:46:01 +0000
On Thu, Jan 11, 2024 at 10:13 PM Stefan Kangas <stefankangas <at> gmail.com> wrote:
>
> João Távora <joaotavora <at> gmail.com> writes:
>
> > On Thu, Jan 11, 2024 at 9:12 PM Stefan Kangas <stefankangas <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Fri, 12 Jan 2024 00:57:02 GMT) Full text and rfc822 format available.

Message #41 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Okamsn <okamsn <at> protonmail.com>
To: João Távora <joaotavora <at> gmail.com>,
 Stefan Kangas <stefankangas <at> gmail.com>
Cc: 67611 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Fri, 12 Jan 2024 00:55:47 +0000
João Távora wrote:
> 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)))
> ;; => (42 2)
>     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?

It is possible. You can give a pattern instead of a symbol for the 
variable, but you have to use a version of `&key` variables in which the 
pattern can't be confused for the normal `((KEY VAR) DEFAULT SUPPLIED)` 
form.  Please try the following:

     ;; => (42 2)
     (pcase (list :c 42)
       ((cl-arglist (&key ((:c (and 43 c)))))
        (list c 1))
       ((cl-arglist (&key ((:c (and 42 c)))))
        (list c 2)))

     ;; => (42 2)
     (pcase (list :c 42)
           ((cl-arglist (&key ((:c (and 43 c)))))
            (list c 1))
           ((cl-arglist (&key ((:c (and (pred (equal 42))
                                        c)))))
            (list c 2))
           ((cl-arglist (&key ((:c (and 44 c)))))
            (list c 3)))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Fri, 12 Jan 2024 03:06:02 GMT) Full text and rfc822 format available.

Message #44 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: João Távora <joaotavora <at> gmail.com>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent
 to `cl-destructuring-bind`
Date: Thu, 11 Jan 2024 22:04:51 -0500
>> 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.

Agreed.

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

It's a pure extension.  The question is not whether the patch is good or
bad or whether it makes the existing infrastructure too complex.
It's rather where should such a thing live.

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.

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


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Fri, 12 Jan 2024 10:48:02 GMT) Full text and rfc822 format available.

Message #47 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Fri, 12 Jan 2024 10:46:43 +0000
[Message part 1 (text/plain, inline)]
On Fri, Jan 12, 2024 at 3:05 AM Stefan Monnier <monnier <at> 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
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Fri, 12 Jan 2024 15:39:01 GMT) Full text and rfc822 format available.

Message #50 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: João Távora <joaotavora <at> gmail.com>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent
 to `cl-destructuring-bind`
Date: Fri, 12 Jan 2024 10:38:50 -0500
>> 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.

Only some of them are.  Others are perfectly happy with using `pcase`
but still aren't super happy about combining the complexity of `pcase`
with that of CL destructuring syntax.

Personally I'm rather put off by the difficulty of figuring out which
part is using CL syntax and which part is using Pcase: the transition
from Pcase to CL is fairly clear (marked by `cl-arglist` or somesuch),
but the other is much less so.

I'd be happier with a `cl-arglist` which cannot contain nested Pcase
patterns (i.e. a one-way street from Pcase to CL) with
`cl-destructuring-bind` reimplemented on top of it.

I'd also be interested in a new Pcase pattern that provides the part of
`cl-arglist` functionality that's missing from current Pcase patterns
(like "optional" elements in a list), but with a syntax that blends
better in Pcase patterns.

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

That's a different question: improving up cl-lib's implementation would
be welcome, yes.  That's not what the current patch does, tho.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Fri, 12 Jan 2024 16:57:01 GMT) Full text and rfc822 format available.

Message #53 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Fri, 12 Jan 2024 16:56:25 +0000
reopen 67611
thanks

On Fri, Jan 12, 2024 at 3:38 PM Stefan Monnier <monnier <at> 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.
>
> Only some of them are.  Others are perfectly happy with using `pcase`
> but still aren't super happy about combining the complexity of `pcase`
> with that of CL destructuring syntax.
>
> Personally I'm rather put off by the difficulty of figuring out which
> part is using CL syntax and which part is using Pcase: the transition
> from Pcase to CL is fairly clear (marked by `cl-arglist` or somesuch),
> but the other is much less so.
> I'd be happier with a `cl-arglist` which cannot contain nested Pcase
> patterns (i.e. a one-way street from Pcase to CL) with
> `cl-destructuring-bind` reimplemented on top of it.

Can a pcase extension even be a one-way street?   And if so, isn't
that contrary to the whole purpose of pcase itself? Why have this ban
specifically on a CL pattern (should really be called "lambda-list"
by the way) when we have a cl library in core and so many uses
of CL things that use CL-style lambda lists, with or without cl-*.el.

We have so many other less commonly used extensions, some of them
subtle performance problems, like seq extensions that rely on generic
functions.

Pcase is complicated and hard-to-follow yes.  Becasue complex pattern
matching is a complicated thing to express, just as regular expressions
are such a thing (I for one do not think 'rx' makes things particularly
simpler). If you ask me, we'd be better off designing an "explain pcase"
utility or designing font-lock rules that helps explain it.

The byte-compiler  is already traversing that anyway and flagging
unused variables and stuff.  Can't we use this to mark what is a
lexical variable and what is a literal symbol, for example?  Can't
we have a very clear highlighting of the pcase extension being
used, like highlighting the '`' or the 'cl-arglist' or the 'seq'.

> I'd also be interested in a new Pcase pattern that provides the part of
> `cl-arglist` functionality that's missing from current Pcase patterns
> (like "optional" elements in a list), but with a syntax that blends
> better in Pcase patterns.

I'd rather not reinvent half-baked CL things, as it's all
too common to discover later we should have gone full-baked and
we have digressed for no good reason.

> > 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.
>
> That's a different question: improving up cl-lib's implementation would
> be welcome, yes.  That's not what the current patch does, tho.

It provides a tool to help do that, of course.

Anyway if there's some common ground here, let's not throw
the entire baby out with the bathwater.

Maybe Okamsn can repurpose the helper function he created
to parse lambda lists to be akin to Alexandria's
parse-simple-lambda-list.  It seems it already is fairly
close (the alist retun type in Elisp is natural as we don't
have multiple values).  Also the function's implementaion
should be changed to rely on as little as possible of
existing cl-macs (cl-copy-list and cl-flet can maybe
be skipped -- and maybe added back again later).

Shoulnd't be a very hard job (I might be wrong).

Then we can consider merging that including figuring out
where to merge it.

And then we can continue discussing about the usefulness
the pcase patterns that can be built with it, sure.

I've reopened the bug.

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Sat, 13 Jan 2024 06:39:02 GMT) Full text and rfc822 format available.

Message #56 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Sat, 13 Jan 2024 00:38:52 -0600
João Távora <joaotavora <at> gmail.com> writes:

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

Yes, on two separate lines to the control@ address.




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 13 Jan 2024 06:44:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Sat, 13 Jan 2024 06:59:01 GMT) Full text and rfc822 format available.

Message #61 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>, 
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611 <at> debbugs.gnu.org
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Sat, 13 Jan 2024 00:58:49 -0600
João Távora <joaotavora <at> gmail.com> writes:

> Pcase is complicated and hard-to-follow yes.  Becasue complex pattern
> matching is a complicated thing to express, just as regular expressions
> are such a thing

Pretty much, yes.  We could improve its documentation though.

We could add a tutorial to the ELisp manual, for example (probably not
included in the printed version).

> If you ask me, we'd be better off designing an "explain pcase"
> utility or designing font-lock rules that helps explain it.
>
> The byte-compiler  is already traversing that anyway and flagging
> unused variables and stuff.  Can't we use this to mark what is a
> lexical variable and what is a literal symbol, for example?  Can't
> we have a very clear highlighting of the pcase extension being
> used, like highlighting the '`' or the 'cl-arglist' or the 'seq'.

That would be very useful to explore, I think.




Removed tag(s) notabug and wontfix. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 13 Jan 2024 10:47:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Sun, 14 Jan 2024 03:09:02 GMT) Full text and rfc822 format available.

Message #66 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: okamsn <at> protonmail.com, 67611 <at> debbugs.gnu.org, joaotavora <at> gmail.com,
 stefankangas <at> gmail.com
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Sat, 13 Jan 2024 22:08:24 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Would someone please tell me what syntax is being proposed here,
and show me an example, saying what it would mean?

I would like to try to adapt it it to cond*.  Maybe I could make it
simple enough for people to like it.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Sun, 14 Jan 2024 03:14:01 GMT) Full text and rfc822 format available.

Message #69 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Richard Stallman <rms <at> gnu.org>
Cc: okamsn <at> protonmail.com, 67611 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, stefankangas <at> gmail.com
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent
 to `cl-destructuring-bind`
Date: Sun, 14 Jan 2024 03:12:53 +0000
Richard Stallman <rms <at> gnu.org> writes:

> Would someone please tell me what syntax is being proposed here,
> and show me an example, saying what it would mean?

Common-lisp style lambda lists.  The ones containing the &key and
&optional with more features.  It'd make it possible to use pcase for
things similar to cl-destructuring-bind, which I suppose you know.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Wed, 17 Jan 2024 03:31:02 GMT) Full text and rfc822 format available.

Message #72 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: 67611 <at> debbugs.gnu.org
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Tue, 16 Jan 2024 22:29:57 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > Would someone please tell me what syntax is being proposed here,
  > > and show me an example, saying what it would mean?

  > Common-lisp style lambda lists.  The ones containing the &key and
  > &optional with more features.

Thanks for answering, but its meaning is not concretely clear to me.

Could you tell me more concretely what this proposed feature would
look like in use?  Perhaps with an example including context?

pcase does not use lambda lists, and neither does cond*.  They are
based on the backquote construct, which does not use &-keywords.
I see a danger of conceptual incoherence here.

If we want to extend the kinds of constructs for destructuring lists,
we should extend the features of backquote.  That would give a more
coherent interface.

We could define ,? to specify an element that might br missing,
and ,& to specify a keyword argument.  These could work in backquote
for constructing lists as well as in destructiring.

(let ((x 9) (y 10) (z nil) (u 11) (v nil) (w '(12 13)))
  `(a ,x ,?y ,?z ,&(foo u) ,&(bar v) . ,w))

=> (a 9 10 foo 11 12 13)

That is my first stab at the design.  I think it is better,
for this purpose, than using parmlist keywords.
But maybe with more thinking we can find improvements.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Wed, 17 Jan 2024 09:13:02 GMT) Full text and rfc822 format available.

Message #75 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: rms <at> gnu.org
Cc: 67611 <at> debbugs.gnu.org
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Wed, 17 Jan 2024 09:12:07 +0000
On Wed, Jan 17, 2024 at 3:29 AM Richard Stallman <rms <at> gnu.org> wrote:

> Could you tell me more concretely what this proposed feature would
> look like in use?  Perhaps with an example including context?

Many examples in the patch, have you looked?

> pcase does not use lambda lists, and neither does cond*.

Pcase it extensible for any object structure the user may
think of you can think of. This proposal is an extension.

Here's an example

(pcase some-mistery-object
   ((cl-arglist (42 &key a b c))  ; this proposal
    (message "Oh, it starts it 42 and has c=%s" c))
   (`(,_ ,x ,_)
    (message "Boring three-element list with middle %s" x))
   (`[,_ ,x ,_]
    (message "Fancy vector with middle %s" x))
   ((franklinboing (nixneez)) ; my data-structure
    (message "This franklinboing has some nice nixneez %s=" nizneez)))

João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Thu, 08 Feb 2024 03:50:02 GMT) Full text and rfc822 format available.

Message #78 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: 67611 <at> debbugs.gnu.org
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Wed, 07 Feb 2024 22:49:01 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > Could you tell me more concretely what this proposed feature would
  > > look like in use?  Perhaps with an example including context?

  > Many examples in the patch, have you looked?

I would not think of looking at a patch to code I don't understand.
To try to read and understand such a patch would be doing it the hard
way, and not wise.  Instead I asked you to send me examples so I could
get that information the easy way.

The examples in your patch could have done it if you had send me those
examples separatrly.  It's far more helpful to send an example than to
say, "Look through the patch for some."

  > (pcase some-mistery-object
  >    ((cl-arglist (42 &key a b c))  ; this proposal
  >     (message "Oh, it starts it 42 and has c=%s" c))
  >    (`(,_ ,x ,_)
  >     (message "Boring three-element list with middle %s" x))
  >    (`[,_ ,x ,_]
  >     (message "Fancy vector with middle %s" x))
  >    ((franklinboing (nixneez)) ; my data-structure
  >     (message "This franklinboing has some nice nixneez %s=" nizneez)))

Thanks.  Now I understand what your extension would be.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Thu, 08 Feb 2024 13:43:02 GMT) Full text and rfc822 format available.

Message #81 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: rms <at> gnu.org
Cc: 67611 <at> debbugs.gnu.org
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Thu, 8 Feb 2024 13:41:49 +0000
On Thu, Feb 8, 2024 at 3:49 AM Richard Stallman <rms <at> gnu.org> wrote:
>
> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
> [[[ whether defending the US Constitution against all enemies,     ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>   > > Could you tell me more concretely what this proposed feature would
>   > > look like in use?  Perhaps with an example including context?
> examples separatrly.  It's far more helpful to send an example than to
> say, "Look through the patch for some."

You do this very often where you ask someone to summarize or explain
context just for you.  That's perfectly fine, you're polite and not
generally imposing.  But since we're all busy individuals, I also think
it's fine to point out that what you're looking for is close by.

>   > (pcase some-mistery-object
>   >    ((cl-arglist (42 &key a b c))  ; this proposal
>   >     (message "Oh, it starts it 42 and has c=%s" c))
>   >    (`(,_ ,x ,_)
>   >     (message "Boring three-element list with middle %s" x))
>   >    (`[,_ ,x ,_]
>   >     (message "Fancy vector with middle %s" x))
>   >    ((franklinboing (nixneez)) ; my data-structure
>   >     (message "This franklinboing has some nice nixneez %s=" nizneez)))
>
> Thanks.  Now I understand what your extension would be.

This is very similar from what you find in the patch in the form of ert tests.
Also it's not my extension.

Thanks,
João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Sun, 11 Feb 2024 03:29:02 GMT) Full text and rfc822 format available.

Message #84 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: 67611 <at> debbugs.gnu.org
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Sat, 10 Feb 2024 22:28:27 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  >   But since we're all busy individuals, I also think
  > it's fine to point out that what you're looking for is close by.

Thousands of incoming messages are close by in that same sense.  26 of
them have this same Subject line.  To find a specific one, not by a
string that uniquiely identifies it but by understanding what each one
says, would take a long time.  Then I would have to look through the
patch for examples.  That would be easy if the patch is short, but I
don't know how long it is.

If I made a habit of searching for everything myself rather than
asking for help from people who might find it quickly, I would fall
even more behind.

Thank you for helping me keep up.

  > Also it's not my extension.

I did not know who had wrote it, and I didn't intend the request
to be only to you.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67611; Package emacs. (Mon, 12 Feb 2024 15:34:01 GMT) Full text and rfc822 format available.

Message #87 received at 67611 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: rms <at> gnu.org
Cc: 67611 <at> debbugs.gnu.org
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Mon, 12 Feb 2024 15:25:48 +0000
[Message part 1 (text/plain, inline)]
On Sun, Feb 11, 2024 at 3:28 AM Richard Stallman <rms <at> gnu.org> wrote:

> If I made a habit of searching for everything myself rather than
> asking for help from people who might find it quickly, I would fall
> even more behind.

I think your stance makes sense in an employer-employee relationship.
Personally, I don't search for "everything", just "some of it".  It's a
balance
worth honing.  As I wrote, asking is fine, so is replying that the answer

is nearby.  Sometimes I ask (in fact I did here, if you care to look up),
sometimes the answer really is nearby and it's just a question of using
a MUA to read up-thread.  You're free to ignore this advice, of course,
 I'm
just supplying it since you took issue with my "examples are in the patch".

João
[Message part 2 (text/html, inline)]

Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Sun, 23 Feb 2025 06:09:02 GMT) Full text and rfc822 format available.

Notification sent to Okamsn <okamsn <at> protonmail.com>:
bug acknowledged by developer. (Sun, 23 Feb 2025 06:09:02 GMT) Full text and rfc822 format available.

Message #92 received at 67611-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Okamsn <okamsn <at> protonmail.com>, 67611-done <at> debbugs.gnu.org,
 João Távora <joaotavora <at> gmail.com>
Subject: Re: bug#67611: [PATCH] Add a Pcase pattern `cl-lambda` equivalent to
 `cl-destructuring-bind`
Date: Sun, 23 Feb 2025 06:07:33 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> 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.
>
> Agreed.
>
>> 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.
>
> It's a pure extension.  The question is not whether the patch is good or
> bad or whether it makes the existing infrastructure too complex.
> It's rather where should such a thing live.
>
> 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.
>
> I'd be quite happy to include such a think in GNU ELPA, OTOH.

This thread lead to some interesting discussions, but ultimately I think
for the OPs suggestion to fly it would have to be repackaged as a GNU
ELPA package.  So this is the recommendation for now, and please open a
new bug report for the GNU ELPA submission.

With that, I'm closing this bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 23 Mar 2025 11:24:16 GMT) Full text and rfc822 format available.

This bug report was last modified 49 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.