[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Re: Code for cond*
From: |
Drew Adams |
Subject: |
RE: [External] : Re: Code for cond* |
Date: |
Wed, 24 Jan 2024 16:30:01 +0000 |
> But oddly enough, this thread discussing its potential
> replacement has given me the key insight — “imagine
> running list interpolation backwards”. With that mental
> model, I find I can now read pcase forms much more easily
> and confidently.
>
> A short introductory paragraph in the elisp pcase
> documentation which explains this approach to its novel
> syntax would have gone a long way for me.
Indeed, this is the place for the pcase doc to
_start_. Unfortunately, the doc doesn't do that.
There _is_ a pcase doc _subnode_ that covers such
pattern-matching destructuring, but this should
be up-front. It's _the most important_ feature
to point out and make clear. It's the easiest to
grasp and the most useful for understanding the
rest.
The subnode covering destructuring is the very
_last_ one, "Destructuring with pcase Patterns":
https://www.gnu.org/software/emacs/manual/html_node/elisp/Destructuring-with-pcase-Patterns.html
___
I specifically suggested such doc improvements
in an enhancement request, but they were
unfortunately summarily dismissed just a few
minutes after the suggestion was received:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68029#13
About this I said, e.g.:
Such advantages should start with DESTRUCTURING -
the ONE thing you _don't_ have built-in with the
existing Elisp binding forms or conditional forms.
Start with a simple destructuring example:
`case'-like, but with destructuring. That's my
advice.
Destructuring is the easiest & most powerful `pcase'
feature to introduce, and it's not really shown.
It's glossed over, at best. Show beginners that, to
start with.
In a nutshell, `pase-let' vs `let' is really the
place to start. _Then_ add conditional control into
the mix.
[The current top-level, beginning `pcase' doc is] as
if someone only tried to explain away some of what
is particularly confusing about `pcase', instead of
teaching the strengths of `pcase'.
- Re: Code for cond*, (continued)
- Re: Code for cond*, Stefan Monnier, 2024/01/23
- Re: Code for cond*, JD Smith, 2024/01/23
- Re: Code for cond*, Stefan Kangas, 2024/01/24
- Re: Code for cond*, JD Smith, 2024/01/24
- Re: Code for cond*, Stefan Monnier, 2024/01/24
- Re: Code for cond*, Stefan Monnier, 2024/01/24
- Re: Code for cond*, JD Smith, 2024/01/24
- Re: Code for cond*, Stefan Monnier, 2024/01/24
- RE: [External] : Re: Code for cond*, Drew Adams, 2024/01/24
- RE: [External] : Re: Code for cond*,
Drew Adams <=
- Re: Code for cond*, Madhu, 2024/01/25
- Re: Code for cond*, Stefan Monnier, 2024/01/25
- Re: Code for cond*, JD Smith, 2024/01/25
- Re: Code for cond*, JD Smith, 2024/01/25
- Re: Code for cond*, Alfred M. Szmidt, 2024/01/25
- Re: Code for cond*, JD Smith, 2024/01/25
- Re: Code for cond*, Stefan Monnier, 2024/01/25
- Re: Code for cond*, Alfred M. Szmidt, 2024/01/25
- Re: Code for cond*, Stefan Monnier, 2024/01/25
- Re: Code for cond*, JD Smith, 2024/01/25