emacs-devel
[Top][All Lists]
Advanced

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

Re: Code for cond*


From: Alfred M. Szmidt
Subject: Re: Code for cond*
Date: Sun, 25 Feb 2024 12:46:05 -0500

   Hello, Stefan.

   On Sun, Feb 25, 2024 at 10:38:46 -0500, Stefan Monnier wrote:
   > > On a slightly different topic, when will cond* be added/commited to
   > > GNU Emacs?  Seeing that how cond* works, and documentation has
   > > slightly materialized, it would be good to get some milage.

   I agree.

   > FWIW, I'm opposed to adding it without first unifying the Pcase and
   > `match*` pattern languages (including making sure that third party
   > packages which define their own patterns don't need to define them
   > separately for `pcase` and for `match*`).

   > [ It's trivial to do by making `match*` reuse the Pcase machinery, so
   >   there is no serious obstacle for that.  ]

   I hope that cond* won't be written on top of pcase.  The pcase machinery
   is almost entirely undocumented (and even the "almost" might be an
   exaggeration), and that doesn't look like changing any time soon.

   Debugging pcase itself, or a backtrace involving one of its expansions
   are thus difficult unpleasant tasks.  (I speak from experience.)

I'm sitting on the fence on this (since I don't have to bother with
the complicated expansions from pcase) -- but from a quick glance, the
code for cond* is much easier to grok than pcase, for similar reasons
above but also just how the code is written.

   cond* looks like being better on the first point, and might well be
   better on the second.  Those putative advantages would be lost by basing
   cond*'s implementation on pcase.

Since cond* is much easier to understand, I hope that in a few years
the usages of pcase will vaniahs slowly but surely .. and maybe even
that that pcase could be rewritten using cond*.



reply via email to

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