unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Bruno Barbier <brubar.cs@gmail.com>
To: Marco Antoniotti <marcoxa@gmail.com>
Cc: 70597@debbugs.gnu.org
Subject: bug#70597: Problem in pcase-let?
Date: Sun, 28 Apr 2024 12:01:18 +0200	[thread overview]
Message-ID: <662e1e70.050a0220.3a3a2.45d1@mx.google.com> (raw)
In-Reply-To: <CAKmY7cXKs_AE_2yBt9CcV7tTkeT4bz0oYFBcadjCfk90b2H00w@mail.gmail.com>


Hi Marco,

Marco Antoniotti <marcoxa@gmail.com> writes:

> Hi Bruno
>
> Thank you for the reply, but sorry.  IMHO it is a bug,  At a minimum,
> because pcase and pcase-let behave differently.

> I may be inclined to accept the explanation that the documentation about
> pcase-let allows for the behavior I find incorrect; that does not mean that
> the behavior is what is normally expected.
>
> Pattern matchers do ... pattern matching.  If you allow quasiquotes or
> "incomplete specifications" (pick your preferred pattern matching
> terminology), then you should honor the expectations; hence two symbols
> that are not eq do not match.

So, you would prefer for pcase-let to always signal an error if a
pattern doesn't match.  It makes sense.

And it looks like the issue has already been raised: see bug#19670.
   (see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19670)



> Also note that I do not have any star (*) operators in my examples.

Thanks for mentionning this.  I now see that you carefully crafted
your HTML version, but, I only used the text version (that is less
readable and contains plenty of stars).  Sorry about the noise,
explaining how to parse generated lightweight markup as elisp :)


> Again, the machinery is there, cfr, the example below, which selects the
> second clause.
>
> ELISP>
>
> *(pcase '(1 2 3 4)           (`(1 2 ,x 5) (list 42 x))           (`(1 ,x 3
> 4) (list 666 x)))*
> *(666 2)*

I'm not sure it's that obvious: pcase doesn't really make a difference
between match and no match:

     (eq (pcase 'b (`a t) (`b nil))
         (pcase 'c (`a t) (`b nil)))
     ==> t


If your request is really like bug#19670, further discussion should
probably go there.

All the best,
Bruno





  reply	other threads:[~2024-04-28 10:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 18:00 bug#70597: Problem in pcase-let? Marco Antoniotti
2024-04-27 16:11 ` Bruno Barbier
2024-04-27 22:28   ` Marco Antoniotti
2024-04-28 10:01     ` Bruno Barbier [this message]
2024-04-28 10:07       ` Ihor Radchenko
2024-04-28 10:18         ` Eli Zaretskii
2024-04-28 15:22     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-28 15:38       ` Marco Antoniotti
2024-04-28 17:05         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-28 18:22           ` Marco Antoniotti
2024-04-28 21:08             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-02  9:23               ` Eli Zaretskii
2024-05-02 11:06                 ` Marco Antoniotti
2024-05-04 11:35                   ` Eli Zaretskii
2024-05-04 12:06                     ` Marco Antoniotti
2024-05-04 15:05                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-05  8:49                         ` Marco Antoniotti
2024-05-04 15:23               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=662e1e70.050a0220.3a3a2.45d1@mx.google.com \
    --to=brubar.cs@gmail.com \
    --cc=70597@debbugs.gnu.org \
    --cc=marcoxa@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).