emacs-devel
[Top][All Lists]
Advanced

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

Re: Replace trivial pcase occurrences in the Emacs sources


From: Eric Abrahamsen
Subject: Re: Replace trivial pcase occurrences in the Emacs sources
Date: Tue, 30 Oct 2018 16:30:05 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> In fact, when you think about it, the "case" nature of pcase is pretty
>> orthogonal to the "match/destructure" nature of pcase. If anything
>
> How do you suggest to split the two in cases like:
>
>     (defun cconv-convert (form env extend)
>       (pcase form
>         (`(,(and letsym (or `let* `let)) ,binders . ,body)
>          ...)
>     
>         (`(,(and `(lambda . ,_) fun) . ,args)
>          ...)

[...]

>...)))
>
> That kind of use is the main motivation behind the design of pcase.
>
> Once you have this, you also trivially cover the `cl-case` uses and you
> can easily make it handle the "destructuring" uses.
> Splitting the two will just require more code to get less flexibility.

Sure, it was just a little realization I had, probably nothing that
should lead to an actual code change.

What I imagined, for a moment there, were matching forms that would look
like "(m ,(and `(lambda . ,_) fun))", or something, and then you could use
that matching form in a cl-case clause, or a lambda argument, or a
dolist variable name. Ie, confining the pattern matching/destructuring
to a form, which could be used in the existing macros/functions like
cl-case or dolist.

I can be safely ignored!

Eric




reply via email to

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