unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen via "Emacs development discussions." <emacs-devel@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: Instead of pcase
Date: Fri, 01 Dec 2023 16:47:51 +0100	[thread overview]
Message-ID: <87plzp53h4.fsf@web.de> (raw)
In-Reply-To: 83a5qubfud.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

> > 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?
>
> It was taken from one of the posted examples, perhaps with a typo.
> But that is not relevant.

My question was meant sincerely.  Did you try to understand the syntax?
How?  What was or is still unclear to you?

> Are you saying pcase doesn't have
> constructs like (`(SOMETHING...), or that SOMETHING doesn't use
> periods in places where they are redundant in "normal" ELisp code?

Redundant - no.  May there be different redundant ways to express lists
- yes.

If you use a backquote pattern `SOMETHING in pcase, when SOMETHING
should match a cons (lists are conses), then SOMETHING will typically be
a cons.  The dot reader syntax is the canonical read syntax for conses.
This is not that weird.

> IOW, these details are not the point, the point is something else
> entirely, see below [...]

> My point focuses on the problems this syntax causes to someone who
> doesn't have intimate knowledge and a lot of practice with pcase.

It is repeatedly used a wording like "magical", as if that was an
argument.  Ok, this syntax makes one first wonder how it has to be
interpreted.  Happened to me, too.  But this (the wondering) takes only
seconds.  What happens after that?  Have people then seriously tried to
understand the syntax?  Where and why did they fail?  I heard nothing
about that.  Just a repetition that it looks "strange" or "magical" or
that one would expect a different syntax.

Given that cons cells and lists are fundamental building blocks of the
whole language, I had hoped to hear more about why understanding this
would be hard.  Nobody did that concretely apart from Richard.  And it
might be the case that his rewrite will reuse the backquote syntax.

> > As an alternative one can have a look at the docstring.
>
> It is a disadvantage if one needs to consult doc strings all the time
> while reading code.  And in this case, the doc string is quite long
> and highly non-trivial (and rightfully so, since the DSL is a rather
> complex one).

This is, or should, not be the case.  Sometimes one might need to recall
the argument order of 'let' or 'app', but more when writing code.

I don't ever need to consult the documentation of `pcase' when reading
code, apart from the case when additional pcase macros are involved
(like 'map').  And I don't have a good such a good memory for such
things.

And I use it only in rare circumstances, where possible I prefer `if',
`cond', and `if-let'.

> If one bumps into such constructs very frequently, then eventually one
> will become familiarized with them.  But if the frequency is low
> enough, one could easily forget the details, and then one will need to
> consult the documentation again the next time.

What I want to say is that if you need to consult documentation of
backquote syntax in pcase again and again, you might not have understood
it entirely.  This is my question: do people fail to understand the
concept, or don't they even try?

> Please don't underestimate these difficulties, even if you don't share
> them.

I still try to understand them.


Michael.




  reply	other threads:[~2023-12-01 15:47 UTC|newest]

Thread overview: 342+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16  3:04 Instead of pcase Richard Stallman
2023-11-16  7:37 ` Philip Kaludercic
2023-11-16 17:18   ` T.V Raman
2023-11-16 17:44     ` Michael Heerdegen
2023-11-16 18:16       ` Philip Kaludercic
2023-11-17  8:54         ` Complex SPEC for variables/customization like font-lock-keywords/org-capture-templates/etc (was: Instead of pcase) Ihor Radchenko
2023-11-25  4:03           ` Complex SPEC for variables/customization like font-lock-keywords/org-capture-templates/etc Stefan Monnier
2023-11-16 19:19       ` Instead of pcase Eli Zaretskii
2023-11-17  8:02         ` Michael Heerdegen
2023-11-16 18:21     ` Dmitry Gutov
2023-11-16 18:39       ` T.V Raman
2023-11-16 18:47         ` Philip Kaludercic
2023-11-16 18:51           ` T.V Raman
2023-11-18  3:04           ` Richard Stallman
2023-11-19 12:23             ` Michael Heerdegen
2023-11-19 16:02               ` Barry Fishman
2023-11-19 17:59                 ` Dmitry Gutov
2023-11-19 19:31                   ` Eric Abrahamsen
2023-11-25  4:23                     ` Stefan Monnier via Emacs development discussions.
2023-11-27  3:12                       ` Richard Stallman
2023-11-19 21:15                   ` Barry Fishman
2023-11-20  1:15                     ` Dmitry Gutov
2023-11-20 15:32                     ` Michael Heerdegen
2023-11-23  2:57                       ` Richard Stallman
2023-11-24 17:14                         ` Dmitry Gutov
2023-11-27  3:09                           ` Richard Stallman
2023-11-27 12:21                             ` Dmitry Gutov
2023-11-29  3:42                               ` Richard Stallman
2023-11-29 12:56                                 ` Dmitry Gutov
2023-12-01  3:17                                   ` Richard Stallman
2023-11-28  2:44                           ` Richard Stallman
2023-11-28 12:39                             ` Dmitry Gutov
2023-11-30  3:37                               ` Richard Stallman
2023-12-01  0:18                                 ` Dmitry Gutov
2023-12-01  5:51                                   ` Emanuel Berg
2023-12-10  8:34                                     ` Alfred M. Szmidt
2023-12-10  9:35                                       ` Eli Zaretskii
2023-12-10  9:53                                         ` Alfred M. Szmidt
2023-12-10 10:35                                           ` Eli Zaretskii
2023-12-10 11:05                                             ` Alfred M. Szmidt
2023-12-01  7:21                                   ` Eli Zaretskii
2023-12-01  8:03                                     ` Manuel Giraud via Emacs development discussions.
2023-12-02  3:21                                   ` Richard Stallman
2023-11-24 18:14                         ` Michael Heerdegen
2023-11-24 18:35                           ` Dmitry Gutov
2023-11-27  3:14                           ` Richard Stallman
2023-11-28  2:46                             ` Richard Stallman
2023-11-28  6:35                               ` Nikita Domnitskii
2023-11-30  3:37                                 ` Richard Stallman
2023-12-02 21:37                                 ` Lynn Winebarger
2023-12-10 15:14                             ` Richard Stallman
2023-12-10 16:27                               ` Lynn Winebarger
2023-12-10 20:28                                 ` Michael Heerdegen via Emacs development discussions.
2023-12-10 21:13                                   ` Lynn Winebarger
2023-12-12  3:43                                   ` Richard Stallman
2023-12-12  6:46                                     ` Tomas Hlavaty
2023-12-12 15:18                                     ` [External] : " Drew Adams
2023-12-14  3:24                                       ` Richard Stallman
2023-12-14 16:52                                         ` Drew Adams
2023-12-16  4:24                                           ` Richard Stallman
2023-12-16  5:04                                             ` Drew Adams
2023-12-16 18:30                                               ` Bob Rogers
2023-12-18  4:13                                                 ` Richard Stallman
2023-12-12 19:24                                     ` Tomas Hlavaty
2023-12-12 21:36                                       ` [External] : " Drew Adams
2023-12-12 22:25                                         ` Michael Heerdegen via Emacs development discussions.
2023-12-13  1:32                                     ` Adam Porter
2023-12-14  3:23                                       ` Richard Stallman
2023-12-16  4:23                                       ` Richard Stallman
2023-12-18  4:09                                         ` cond* Richard Stallman
2023-12-18 10:08                                           ` cond* João Távora
2023-12-21  4:20                                             ` cond* Richard Stallman
2023-12-21  9:50                                               ` cond* João Távora
2023-12-21 16:01                                                 ` [External] : cond* Drew Adams
2023-12-21 16:20                                                   ` João Távora
2023-12-24  3:56                                                   ` Richard Stallman
2023-12-24  3:57                                                 ` cond* Richard Stallman
2023-12-21 14:10                                               ` cond* Ihor Radchenko
2023-12-24  3:57                                                 ` cond* Richard Stallman
2023-12-25 14:14                                                   ` cond* Ihor Radchenko
2023-12-19  3:49                                           ` cond* Richard Stallman
2023-12-19 12:13                                             ` cond* João Távora
2023-12-22  3:14                                               ` cond* Richard Stallman
2023-12-22  7:27                                                 ` cond* Philip Kaludercic
2023-12-25  3:41                                                   ` cond* Richard Stallman
2023-12-25 12:32                                                     ` cond* Philip Kaludercic
2023-12-27  4:54                                                       ` cond* Richard Stallman
2023-12-27 14:34                                                         ` cond* Philip Kaludercic
2023-12-29  3:52                                                           ` cond* Richard Stallman
2024-01-01 14:49                                                             ` cond* Ihor Radchenko
2024-01-03  4:13                                                               ` cond* Richard Stallman
2024-01-03 15:57                                                                 ` cond* Ihor Radchenko
2024-01-05  4:23                                                                   ` cond* Richard Stallman
2024-01-06 14:33                                                                     ` cond* Ihor Radchenko
2024-01-06 22:25                                                                       ` [External] : cond* Drew Adams
2024-01-08  3:45                                                                         ` Richard Stallman
2024-01-08 15:20                                                                           ` Drew Adams
2024-01-09  2:53                                                                           ` map seq and radix-tree-leaf, in pcase Richard Stallman
2024-01-08  3:47                                                                       ` cond* Richard Stallman
2024-01-10 13:03                                                                         ` cond* Ihor Radchenko
2024-01-13  3:50                                                                           ` cond* Richard Stallman
2024-01-13  6:32                                                                             ` cond* Adam Porter
2024-01-16  3:31                                                                               ` cond* Richard Stallman
2024-01-13 19:47                                                                             ` cond* Ihor Radchenko
2024-01-15  3:13                                                                               ` cond* Richard Stallman
2024-01-08  3:47                                                                       ` cond* Richard Stallman
2024-01-08 15:13                                                                         ` cond* Ihor Radchenko
2024-01-27  3:37                                                                           ` cond* Richard Stallman
2024-02-01 16:26                                                                             ` cond* Ihor Radchenko
2024-02-03  3:36                                                                               ` cond* Richard Stallman
2024-02-03 16:52                                                                                 ` cond* Ihor Radchenko
2024-01-03  4:13                                                               ` cond* Richard Stallman
2024-01-03 15:48                                                                 ` cond* Ihor Radchenko
2024-01-06  4:31                                                                   ` cond* Richard Stallman
2024-01-06 13:09                                                                     ` cond* Ihor Radchenko
2024-01-08  3:47                                                                       ` cond* Richard Stallman
2024-01-08 15:26                                                                         ` cond* Ihor Radchenko
2024-01-27  3:37                                                                           ` cond* Richard Stallman
2024-01-03  4:13                                                               ` cond* Richard Stallman
2024-01-03 15:50                                                                 ` cond* Ihor Radchenko
2024-01-06  4:31                                                                   ` cond* Richard Stallman
2024-01-06 13:13                                                                     ` cond* Ihor Radchenko
2024-01-08  3:47                                                                       ` cond* Richard Stallman
2024-01-08 15:35                                                                         ` cond* Ihor Radchenko
2023-12-19 15:53                                             ` [External] : cond* Drew Adams
2023-12-21  4:22                                               ` Richard Stallman
2023-12-21  4:22                                               ` Richard Stallman
2023-12-18  4:09                                         ` cond* Richard Stallman
2023-12-18  5:41                                           ` cond* Adam Porter
2023-12-21  4:20                                             ` cond* Richard Stallman
2023-12-16  4:23                                       ` Instead of pcase Richard Stallman
2023-12-16  4:23                                       ` Richard Stallman
2023-12-16  6:57                                         ` Adam Porter
2023-12-20  3:28                                           ` Richard Stallman
2023-12-20 10:52                                             ` Adam Porter
2023-12-23  2:53                                               ` Richard Stallman
2023-12-23  2:53                                               ` Richard Stallman
2023-12-25 14:26                                                 ` Ihor Radchenko
2023-12-27  4:54                                                   ` Richard Stallman
2023-12-28 13:05                                                     ` Ihor Radchenko
2023-12-30  3:20                                                       ` Richard Stallman
2024-01-01 14:33                                                         ` Ihor Radchenko
2024-01-03  4:13                                                           ` Richard Stallman
2024-01-03  4:13                                                           ` Richard Stallman
2024-01-03 16:08                                                             ` Ihor Radchenko
2024-01-05  4:23                                                               ` Richard Stallman
2024-01-06 13:04                                                                 ` Ihor Radchenko
2024-01-08  3:47                                                                   ` Richard Stallman
2024-01-08 15:42                                                                     ` Ihor Radchenko
2024-01-27  3:37                                                                       ` Richard Stallman
2023-12-13  4:58                                     ` Richard Stallman
2023-12-11  3:31                                 ` Richard Stallman
2023-11-19 13:49             ` Dmitry Gutov
2023-11-21  2:42               ` Richard Stallman
2023-11-21  5:14                 ` Jim Porter
2023-11-21  5:34                 ` Yuri Khan
2023-11-21 11:11                 ` Dmitry Gutov
2023-11-21 15:38                   ` Michael Heerdegen
2023-11-23  3:00                     ` Richard Stallman
2023-11-24  3:34                   ` Richard Stallman
2023-11-24  4:30                     ` Jim Porter
2023-11-24  7:45                       ` Eli Zaretskii
2023-11-25  3:08                       ` Emanuel Berg
2023-11-24 17:01                     ` Dmitry Gutov
2023-11-24 17:29                 ` Lynn Winebarger
2023-11-28  2:44                   ` Richard Stallman
2023-11-30 19:14                     ` Lynn Winebarger
2023-11-30 19:26                       ` Eli Zaretskii
2023-11-30 20:30                         ` Michael Heerdegen via Emacs development discussions.
2023-12-01  6:24                           ` Eli Zaretskii
2023-12-01 15:47                             ` Michael Heerdegen via Emacs development discussions. [this message]
2023-12-01 16:07                               ` Eli Zaretskii
2023-12-01 20:27                               ` Alan Mackenzie
2023-12-02 13:24                                 ` Michael Heerdegen via Emacs development discussions.
2023-12-02 13:51                                   ` Emanuel Berg
2023-12-04  3:11                                   ` Richard Stallman
2023-12-03  3:28                                 ` Richard Stallman
2023-11-30 20:47                         ` João Távora
2023-12-01  6:31                           ` Eli Zaretskii
2023-12-01  7:07                             ` Yuri Khan
2023-12-01  8:10                               ` Eli Zaretskii
2023-12-01  9:04                                 ` Andreas Schwab
2023-12-04  3:08                                   ` Richard Stallman
2023-12-04 11:58                                     ` Eli Zaretskii
2023-12-04 12:35                                       ` Lynn Winebarger
2023-12-04 13:20                                         ` Eli Zaretskii
2023-12-04 17:46                                           ` Andreas Schwab
2023-12-07  2:48                                             ` Richard Stallman
2023-12-07 17:42                                               ` Andreas Schwab
2023-12-09  4:02                                                 ` Richard Stallman
2023-12-04 18:17                                           ` Lynn Winebarger
2023-12-04 12:37                                       ` Dmitry Gutov
2023-12-08  3:54                                         ` Richard Stallman
2023-12-01 10:13                                 ` João Távora
2023-12-01  8:35                             ` Andreas Schwab
2023-12-01 10:02                             ` João Távora
2023-12-01 11:52                               ` Eli Zaretskii
2023-12-01 12:48                                 ` Dmitry Gutov
2023-12-01 14:44                                   ` Eli Zaretskii
2023-12-01 18:28                                     ` Dmitry Gutov
2023-12-01 18:40                                       ` Eli Zaretskii
2023-12-01 18:45                                       ` João Távora
2024-01-09  5:36                                         ` Stefan Kangas
2023-12-01 13:28                                 ` João Távora
2023-12-01 16:25                                 ` Andreas Schwab
2024-01-09  5:33                               ` Stefan Kangas
2024-01-09 10:43                                 ` João Távora
2023-12-01 16:04                             ` Michael Heerdegen via Emacs development discussions.
2023-12-01 16:33                               ` Eli Zaretskii
2023-12-02  3:20                       ` Richard Stallman
2023-12-02  8:41                         ` Andreas Schwab
2023-12-02  9:02                           ` Philip Kaludercic
2023-12-02 10:14                             ` Emanuel Berg
2023-12-02 17:02                               ` Barry Fishman
2023-12-02 20:25                                 ` Michael Heerdegen via Emacs development discussions.
2023-12-03  4:30                                 ` Emanuel Berg
2023-12-05  2:58                           ` Richard Stallman
2023-12-05  3:36                             ` chad
2023-12-08  3:53                               ` Richard Stallman
2023-12-02 14:33                         ` Michael Heerdegen via Emacs development discussions.
2023-12-04  3:11                           ` Richard Stallman
2023-12-02 18:01                         ` Lynn Winebarger
2023-12-04  3:11                           ` Richard Stallman
2023-12-04 12:27                             ` Lynn Winebarger
2023-12-03  3:27                         ` Richard Stallman
2023-11-25  4:15                 ` Stefan Monnier
2023-11-27  3:12                   ` Richard Stallman
2023-11-30 18:06                     ` Michael Heerdegen
2023-11-16 18:49         ` Dmitry Gutov
2023-11-16 23:41     ` Emanuel Berg
2023-11-17  7:34       ` Eli Zaretskii
2023-11-26  3:17   ` Richard Stallman
2023-11-16 15:06 ` Michael Heerdegen
2023-11-16 17:31   ` T.V Raman
2023-11-16 18:26     ` Jim Porter
2023-11-16 18:40       ` T.V Raman
2023-11-16 19:13         ` Jim Porter
2023-11-20  3:06   ` Richard Stallman
2023-11-20 14:35     ` Michael Heerdegen
2023-11-23  2:57       ` Richard Stallman
2023-11-16 15:20 ` Spencer Baugh
2023-11-16 20:16   ` Tomas Hlavaty
2023-11-16 21:37     ` [External] : " Drew Adams
2023-11-25  4:34     ` Stefan Monnier via Emacs development discussions.
2023-11-25  8:53       ` Eli Zaretskii
2023-11-18  3:03   ` combining cond and let, to replace pcase Richard Stallman
2023-11-19 11:20     ` Michael Heerdegen
2023-11-19 11:43       ` Eli Zaretskii
2023-11-19 12:16         ` Gerd Möllmann
2023-11-19 13:21           ` Eli Zaretskii
2023-11-19 13:32             ` Gerd Möllmann
2023-11-19 14:41               ` Eli Zaretskii
2023-11-19 15:27                 ` Gerd Möllmann
2023-11-19 15:29                   ` Eli Zaretskii
2023-11-19 16:03           ` Joost Kremers
2023-11-19 16:59             ` Eli Zaretskii
2023-11-19 18:29               ` Joost Kremers
2023-11-19 18:35                 ` Eli Zaretskii
2023-11-19 12:50         ` Michael Heerdegen
2023-11-19 13:08           ` Eli Zaretskii
2023-11-19 13:52             ` Michael Heerdegen
2023-11-19 14:45               ` Eli Zaretskii
2023-11-20 15:35                 ` Michael Heerdegen
2023-11-20 16:37                   ` Eli Zaretskii
2023-11-21  8:33                     ` Michael Heerdegen
2023-11-21  8:39                       ` Michael Heerdegen
2023-11-19 13:59             ` Dmitry Gutov
2023-11-19 14:49               ` Eli Zaretskii
2023-11-19 14:53                 ` Dmitry Gutov
2023-11-19 12:04       ` Gerd Möllmann
2023-11-19 18:10       ` Tomas Hlavaty
2023-11-25  4:45         ` Stefan Monnier via Emacs development discussions.
2023-11-28 15:31           ` João Távora
2023-11-28 15:55             ` Stefan Monnier
2023-11-19 21:36       ` Alan Mackenzie
2023-11-21 16:14         ` Michael Heerdegen
2023-11-19 16:08     ` Axel Forsman
2023-11-21 15:53     ` Michael Heerdegen
2023-11-23  2:58     ` Richard Stallman
2023-11-23  7:02       ` Tomas Hlavaty
2023-11-26  3:14         ` Richard Stallman
2023-11-27 17:07           ` Tomas Hlavaty
2023-11-27 17:59             ` Yuri Khan
2023-11-28 14:25               ` Tomas Hlavaty
2023-11-23  8:58       ` Manuel Giraud via Emacs development discussions.
2023-11-26  3:14         ` Richard Stallman
2023-11-24  3:08       ` Daniel Semyonov
2023-11-24  3:26         ` Daniel Semyonov
2023-11-25  2:59         ` Richard Stallman
2023-11-25  5:11       ` Stefan Monnier via Emacs development discussions.
2023-11-27  3:11         ` Richard Stallman
2023-11-27 18:13           ` Manuel Giraud via Emacs development discussions.
2023-11-27 18:49             ` Yuri Khan
2023-11-27 23:12               ` Stefan Monnier
2023-11-29  3:41               ` Richard Stallman
2023-11-29  3:40             ` Richard Stallman
2023-11-27  3:11         ` Richard Stallman
2023-11-16 18:11 ` Instead of pcase Emanuel Berg
2023-11-16 19:26   ` Eli Zaretskii
2023-11-16 22:16     ` Emanuel Berg
2023-11-17  7:30       ` Eli Zaretskii
2023-11-17  8:09         ` Emanuel Berg
2023-11-17 12:16           ` Eli Zaretskii
2023-11-18  6:26             ` Emanuel Berg
2023-11-18  7:21               ` Po Lu
2023-11-18  7:41                 ` Eli Zaretskii
2023-11-16 18:22 ` Jim Porter
2023-11-16 22:55   ` Emanuel Berg
2023-11-17  5:36   ` Po Lu
2023-11-19 11:48     ` Michael Heerdegen
2023-11-19 12:50       ` Eli Zaretskii
2023-11-19 14:05         ` Dmitry Gutov
2023-11-19 14:41           ` Po Lu
2023-11-19 14:44             ` Dmitry Gutov
2023-11-19 14:52           ` Eli Zaretskii
2023-11-19 14:58             ` Dmitry Gutov
2023-11-19 15:14               ` Eli Zaretskii
2023-11-19 18:04                 ` Dmitry Gutov
2023-11-19 18:30                   ` Eli Zaretskii
2023-11-19 18:51                     ` Dmitry Gutov
2023-11-19 19:49                       ` Eli Zaretskii
2023-11-21  2:43               ` Richard Stallman
2023-11-19 14:14         ` Michael Heerdegen
2023-11-19 15:09           ` Eli Zaretskii
2023-11-20 14:52             ` Michael Heerdegen
2023-11-19 14:29       ` Po Lu
2023-11-20 15:20         ` Michael Heerdegen
2023-11-20 15:29         ` Dmitry Gutov
2023-11-20 23:43           ` Po Lu
2023-11-21  1:09             ` Dmitry Gutov
2023-11-21  1:49               ` Po Lu
2023-11-21  1:59                 ` Dmitry Gutov
2023-11-21  4:04                   ` Po Lu
2023-11-21 11:27                     ` Dmitry Gutov
2023-11-21 11:49                       ` Po Lu
2023-11-20 23:45           ` Jose E. Marchesi
2023-11-20 23:54             ` Emanuel Berg
2023-11-21  2:01             ` Dmitry Gutov
2023-11-22  2:59               ` Richard Stallman
2023-11-22  3:29                 ` Emanuel Berg
2023-11-22 11:58                 ` Dmitry Gutov
2023-11-24  3:38                   ` Richard Stallman

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=87plzp53h4.fsf@web.de \
    --to=emacs-devel@gnu.org \
    --cc=michael_heerdegen@web.de \
    /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).