emacs-devel
[Top][All Lists]
Advanced

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

Re: [External] : Re: Code for cond*


From: Madhu
Subject: Re: [External] : Re: Code for cond*
Date: Thu, 01 Feb 2024 14:26:40 +0530

* Drew Adams <SJ0PR10MB54888A62EB6D04026A406136F37B2 
@SJ0PR10MB5488.namprd10.prod.outlook.com> :
Wrote on Wed, 24 Jan 2024 16:30:01 +0000:

[JDS?]
>> 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.

"pcase" assumes that its users are already familiar with the use of
pcase from the other languages where they have used similar control flow
constructs, and it is intuitively obvious to them.  I believe this is
how it has worked, it is extremely effective in attracting programmers
of the a certain "same mindset" to come to emacs, and puts a high
barrier of entry on programmers who do not belong to that mindset,
thereby subtly shaping the programmer demographic which eventually
directs the future of emacs.


> 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'.




reply via email to

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