unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: hokomo <hokomo@airmail.cc>
Cc: 59887-done@debbugs.gnu.org
Subject: bug#59887: pcase vs. pcase-let: Underscore in backquote-style patterns
Date: Tue, 13 Dec 2022 03:21:45 +0100	[thread overview]
Message-ID: <87a63s2gcm.fsf@web.de> (raw)
In-Reply-To: <87lenc84df.fsf@airmail.cc> (hokomo@airmail.cc's message of "Tue,  13 Dec 2022 02:19:22 +0100")

hokomo <hokomo@airmail.cc> writes:

> That indeed describes it nicely. Somehow I managed to miss that whole
> paragraph and instead skipped directly to the documentation string of
> pcase-let. My bad... :-)
>
> > Or should we maybe just warn about the possible pitfall a bit more
> > offensively?

> Perhaps including a variation of the phrase "Each EXP should match
> (i.e. be of compatible structure)" in each of the four descriptions
> would hint at this behavior while not being overly verbose? From that
> point the user can search for "compatible" on the same page and
> immediately find a match in the text at the top that explains the
> constraints.

My question is that when we make the text even longer, would that help
people that don't read carefully (because we don't need to address
others) at all?

My second question is if that would have helped you at all, because your
crucial misunderstanding was about the meaning of `_`.  Using patterns
in `pcase-let' that don't match generally doesn't make much sense, it's
totally unclear what would happen in this case.  That's another reason
why I don't want to over-emphasize this case.

Maybe saying that `_` is not special when used as a QPAT would make
sense, in (info "(elisp) Backquote Patterns").  I mean in this
paragraph:

| ‘SYMBOL’
| ‘KEYWORD’
| ‘NUMBER’
| ‘STRING’
|      Matches if the corresponding element of EXPVAL is ‘equal’ to the
|      specified literal object.

We could add that `_` is not special (no symbol is special as a qpat,
actually).  Would that give a useful hint?  It seems that some people
seem to expect that `_` is special everywhere in pcase.

Michael.





  reply	other threads:[~2022-12-13  2:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 16:28 bug#59887: pcase vs. pcase-let: Underscore in backquote-style patterns hokomo
2022-12-09  2:57 ` Michael Heerdegen
2022-12-12  2:50 ` Michael Heerdegen
2022-12-12 18:26   ` hokomo
2022-12-13  1:17     ` Michael Heerdegen
2022-12-13  1:19       ` hokomo
2022-12-13  2:21         ` Michael Heerdegen [this message]
2022-12-13  2:26           ` hokomo

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=87a63s2gcm.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=59887-done@debbugs.gnu.org \
    --cc=hokomo@airmail.cc \
    /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).