From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Marco Antoniotti Newsgroups: gmane.emacs.bugs Subject: bug#70597: Problem in pcase-let? Date: Sun, 28 Apr 2024 20:22:27 +0200 Message-ID: References: <662d23bf.050a0220.a4e2f.3f45@mx.google.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c5c85006172c38a7" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2253"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Bruno Barbier , 70597@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 28 20:24:02 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s19Bx-0000N0-IG for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Apr 2024 20:24:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s19Bj-0005hw-Ak; Sun, 28 Apr 2024 14:23:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s19Bf-0005hT-7W for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 14:23:43 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s19Be-00010o-VM for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 14:23:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s19By-0005Du-ER for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2024 14:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Marco Antoniotti Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Apr 2024 18:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70597 X-GNU-PR-Package: emacs Original-Received: via spool by 70597-submit@debbugs.gnu.org id=B70597.171432858620054 (code B ref 70597); Sun, 28 Apr 2024 18:24:02 +0000 Original-Received: (at 70597) by debbugs.gnu.org; 28 Apr 2024 18:23:06 +0000 Original-Received: from localhost ([127.0.0.1]:51590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s19B4-0005DO-BT for submit@debbugs.gnu.org; Sun, 28 Apr 2024 14:23:06 -0400 Original-Received: from mail-yw1-x1129.google.com ([2607:f8b0:4864:20::1129]:59402) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s19B2-0005Cz-1z for 70597@debbugs.gnu.org; Sun, 28 Apr 2024 14:23:04 -0400 Original-Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-61b6200fcb5so39328397b3.2 for <70597@debbugs.gnu.org>; Sun, 28 Apr 2024 11:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714328559; x=1714933359; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=S/++dPZ6Yga5M9GM5mXpG3kmgqzX7y2irj/qxy93cFQ=; b=bBcd/z7nxAFMefL3w1WSPzWjBT1Ek0cVXlDMIeMDht62RjQD6/vTbWYl0B7HImqP+8 zmw3nqzW4kxAS5uuHgs2Ci1D6pSYHVPGBjpXd9e1twCPdUb7Mr706J4p59Wl5CALVgZX yK6iISzi+EoPjjRnT7nODrjLcO/u1kj76VvqlYELXXq+7gMCL+56o1LuCefb2GN4PdwG YApCRM7UbMCJSoiGf4eZ61oOgOGuM9bl+dDV48UuDZj2MKZr5wTChfKDMlC82AC1W2z4 9RUpqedlZLbsVZ0fyvyTSpcWFPg8bYsfDzzY7MGleR3gkuWStOKQFwM/YLoFTWm7zJSt 3R9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714328559; x=1714933359; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=S/++dPZ6Yga5M9GM5mXpG3kmgqzX7y2irj/qxy93cFQ=; b=n4In1mfZ+vCAV4QEV9WxenyBY6tXeCldFPEzO30JgW7gxJoZ+VGbrLsaiFgPWL2CUo Y9XQaT9UVHLmL1j09J18/gbBvn3zuPMru5HdGr3T8YlBjGnRK28lqg7ya8WAXuhIbjxk JdpRCm47vmaHX6oQskWKPIMAfTjxxhD5QvgE2CZyuiKpPg4ODjF6kIm5NaTqp8KKfSVH x3sdlULU6XyXwRp9+1Oa7zdE+FpnqbC45F4mm/RA3orKbnPJ6HjgQOWmeQLb+L+yZM5s Md5/koVVyXg3RMvhJsoSMtGViUXtjOP7+jpWuaTTaLYCOxNQWDzXoAfNT68C5zX8zQCi cgsg== X-Forwarded-Encrypted: i=1; AJvYcCXrAhw4HgOIGsqU1DY99bA13tcgZpjwKd9ejQeZuij+QTPrgqaJfLP8asHhS4T4VkoM9SYMkcHncl2qshUyxHCKWlDgoGw= X-Gm-Message-State: AOJu0Yw8PGhIgB2BB49+Ipl2BaZkm04h61BzliBdkncqvgZZWKnVNOJG qTI7nZ/mzepn/vtquB/BSTFEvpqB9M9Hi9mp9b85IzfYlv77qXnp9FJszwoh0mWj6eJj0n0MMRU AP4XieRgyYBh0VPePg4VKmQjegO45rmEl X-Google-Smtp-Source: AGHT+IHYgAAOEHDSSNYKxbQGkU9HNO2GNasw9zOJfJypmDnAj+I6MFV/+5g1l8NH/oLe0QOgvrivrgGG/LU3JDT/TrU= X-Received: by 2002:a05:690c:f88:b0:61a:d455:3dc6 with SMTP id df8-20020a05690c0f8800b0061ad4553dc6mr10610521ywb.11.1714328558747; Sun, 28 Apr 2024 11:22:38 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:284104 Archived-At: --000000000000c5c85006172c38a7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=E2=80=AFPM Stefan Monnier 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 > > --=20 Marco Antoniotti Somewhere over the Rainbow --000000000000c5c85006172c38a7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

oooops sorry.=C2=A0 Someh= ow I was missing cl-destructuring-bin= d; my bad.

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

Your call anyway.

All the best

On Sun, Apr 28, 2024 at 7:05=E2=80=AFPM Stef= an Monnier <monnier@iro.umon= treal.ca> wrote:
> Let me just answer the destructuring-bind comment by Stefan (I= am answering
> to his last email).=C2=A0 The previous ones are somewhat answered here= as well.
>
> In some sense, yes.=C2=A0 I kind of want destructuring-bind.=C2=A0 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 use= ful.

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<= br> > 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:<= br>
=C2=A0 =C2=A0 (pcase-let (`(foo bar ,x) (SOMETHING)) (ANYTHING))

and emit a warning suggesting to rewrite it to

=C2=A0 =C2=A0 (pcase-let (`(,_ ,_ ,x) (SOMETHING)) (ANYTHING))


- Stefan



--
Marco Antonio= tti
Somewhere over the Rainbow
--000000000000c5c85006172c38a7--