[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Instead of pcase
|
From: |
Michael Heerdegen |
|
Subject: |
Re: Instead of pcase |
|
Date: |
Thu, 30 Nov 2023 21:30:00 +0100 |
|
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eli Zaretskii <eliz@gnu.org> writes:
> I think you are missing the point. The point is that pcase has so
> many semi-magical syntax features that use punctuation characters in
> creative ways that every extra punctuation character presents a
> puzzle. Faced with
>
> (`(,hookfun . ,start ,end))
This is not a valid expression and will be rejected by the reader. Was
it a typo or did you think this would be valid?
> one immediately asks himself why the period, where in "normal" Lisp
> expressions it would be completely redundant?
As had been said: the syntax has been chosen intentionally to underline
that it is important to view the matched thing as a cons instead of a
list. If people get crazy about the dot, we can choose a different
syntax without the dot. It is not necessary to use this syntax (unless
the cdr is not a list). This point is not about `pcase' but about how
the author has chosen to write the pattern.
> The fact that it is there then leaves one wondering whether that
> period has some "magical" meaning.
As an alternative one can have a look at the docstring. And learn the
read syntax of cons cells in Lisp. There is not more to wonder about as
there is to wonder about the identity
(X . (Y ...)) == (X Y ...)
People should familiarize themselves a bit with Lisp when working with
the Emacs Lisp source code. I know the above identity can be confusing
_once_, in different situations, not only in `pcase', but it is
something on has to know anyway, and this is really not that difficult
or magical.
Michael.
- Re: Instead of pcase, (continued)
- Re: Instead of pcase, Richard Stallman, 2023/11/22
- Re: Instead of pcase, Richard Stallman, 2023/11/23
- Re: Instead of pcase, Jim Porter, 2023/11/23
- Re: Instead of pcase, Eli Zaretskii, 2023/11/24
- Re: Instead of pcase, Emanuel Berg, 2023/11/25
- Re: Instead of pcase, Dmitry Gutov, 2023/11/24
- Re: Instead of pcase, Lynn Winebarger, 2023/11/24
- Re: Instead of pcase, Richard Stallman, 2023/11/27
- Re: Instead of pcase, Lynn Winebarger, 2023/11/30
- Re: Instead of pcase, Eli Zaretskii, 2023/11/30
- Re: Instead of pcase,
Michael Heerdegen <=
- Re: Instead of pcase, João Távora, 2023/11/30
- Re: Instead of pcase, Stefan Monnier, 2023/11/24
- Re: Instead of pcase, Richard Stallman, 2023/11/26
- Re: Instead of pcase, Michael Heerdegen, 2023/11/30
- Re: Instead of pcase, Dmitry Gutov, 2023/11/16
- Re: Instead of pcase, Emanuel Berg, 2023/11/17
- Re: Instead of pcase, Eli Zaretskii, 2023/11/17
Re: Instead of pcase, Richard Stallman, 2023/11/25
Re: Instead of pcase, Michael Heerdegen, 2023/11/16