[Top][All Lists]

[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

The subnode covering destructuring is the very
_last_ one, "Destructuring with pcase Patterns":


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:


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

  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]