bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59887: pcase vs. pcase-let: Underscore in backquote-style patterns


From: Michael Heerdegen
Subject: bug#59887: pcase vs. pcase-let: Underscore in backquote-style patterns
Date: Tue, 13 Dec 2022 03:21:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]