GNU bug report logs - #70597
Problem in pcase-let?

Previous Next

Package: emacs;

Reported by: Marco Antoniotti <marcoxa <at> gmail.com>

Date: Fri, 26 Apr 2024 21:15:08 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Marco Antoniotti <marcoxa <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Bruno Barbier <brubar.cs <at> gmail.com>, 70597 <at> debbugs.gnu.org
Subject: Re: bug#70597: Problem in pcase-let?
Date: Sun, 28 Apr 2024 20:22:27 +0200
[Message part 1 (text/plain, inline)]
Hi

oooops sorry.  Somehow I was missing cl-destructuring-bind; my bad.

In any case, at a minimum the warning should be issued.  I did refrain from
using pcase-let after all, although it "seemed right" for my use case.
Having said that, I would advocate changing the semantics.

Your call anyway.

All the best

On Sun, Apr 28, 2024 at 7:05 PM Stefan Monnier <monnier <at> iro.umontreal.ca>
wrote:

> > Let me just answer the destructuring-bind comment by Stefan (I am
> answering
> > to his last email).  The previous ones are somewhat answered here as
> well.
> >
> > In some sense, yes.  I kind of want destructuring-bind.  It is, IMHO,
> > unfortunate that ELisp does not have it and that we don't have
> > cl-destructuring-bind either; lower level beast than matching, but
> useful.
>
> I don't understand what you mean: `pcase-let` *is* a destructring bind,
> and we also do have `cl-destructuring-bind`.
>
> > As per the pcase-let, I still think that the name and/or its behavior
> > are confusing because of expectations about how a pattern matcher
> > usually works.
>
> Yes, clearly there is a problem of users being surprised.
>
> But AFAICT, changing the semantics is not the right answer, because the
> current behavior matches(!) what is usually needed and because the other
> behaviors are already well-served by `pcase` and `pcase-exhaustive`.
>
> Maybe a better answer is to try and detect ill-conceived patterns like in:
>
>     (pcase-let (`(foo bar ,x) (SOMETHING)) (ANYTHING))
>
> and emit a warning suggesting to rewrite it to
>
>     (pcase-let (`(,_ ,_ ,x) (SOMETHING)) (ANYTHING))
>
>
> - Stefan
>
>

-- 
Marco Antoniotti
Somewhere over the Rainbow
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 17 days ago.

Previous Next


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