emacs-devel
[Top][All Lists]
Advanced

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

Re: Code for cond*


From: Stefan Monnier
Subject: Re: Code for cond*
Date: Wed, 31 Jan 2024 08:20:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>   > Is this what you're referring to?
>
>   >         ((get (car subpat) 'cond*-expander)
>   >          ;; Treat result as a subpattern.
>   >          (cond*-subpat (funcall (get (car subpat) 'cond*-expander) subpat)
>   >                        cdr-safe bindings backtrack-aliases data))
>
>   > do we have reasons to believe that it's flexible enough?
>
> Nobody is actually using this now, so now is the best time
> to make changes -- perhaps to make it somehow more flexible.
> But I have no concrete idea of what flexibility you wish for.
>
> Can you make a concrete suggestion?  Then I might understand.

As I said: in Pcase I moved some of the "built-in" patterns, such as the
backquote, out of the core (using `pcase-defmacro` to define them
instead), as a way to make sure that `pcase-defmacro` is indeed
flexible enough.
[ And indeed, I couldn't have done that with the first version of Pcase
  because of the lack of `app`.  ]

You could do worse than trying to do exactly that for your patterns.
Tho better would be to just give up on your pattern language and (re)use
Pcase's machinery instead.  Less work, less code duplication, less
documentation duplication, less to learn for coders.  And presumably
you'd then improve Pcase, so everyone wins.


        Stefan




reply via email to

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