[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replace trivial pcase occurrences in the Emacs sources
From: |
Stefan Monnier |
Subject: |
Re: Replace trivial pcase occurrences in the Emacs sources |
Date: |
Tue, 30 Oct 2018 09:07:35 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> 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)
...)
(`(cond . ,cond-forms)
...)
(`(function (lambda ,args . ,body) . ,_)
...)
(`(internal-make-closure . ,_)
...)
(`(quote . ,_) form)
(`(function . ,_) form)
(`(,(and sym (or `defconst `defvar)) ,definedsymbol . ,forms)
...)
((and `(condition-case ,var ,protected-form . ,handlers)
(guard byte-compile--use-old-handlers))
...)
(`(condition-case ,var ,protected-form . ,handlers)
...)
(`(,(and head (or (and `catch (guard byte-compile--use-old-handlers))
`unwind-protect))
,form . ,body)
...)
(`(setq . ,forms)
...)
(`(,(and (or `funcall `apply) callsym) ,fun . ,args)
...)
(`(interactive . ,forms)
...)
(`(declare . ,_) form)
(`(,func . ,forms)
...)
(_
...)))
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.
Stefan
- Re: Replace trivial pcase occurrences in the Emacs sources, (continued)
- Re: Replace trivial pcase occurrences in the Emacs sources, Andy Moreton, 2018/10/27
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/28
- Re: Replace trivial pcase occurrences in the Emacs sources, Alan Mackenzie, 2018/10/29
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/29
- Re: Replace trivial pcase occurrences in the Emacs sources, Alan Mackenzie, 2018/10/29
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/29
- Re: Replace trivial pcase occurrences in the Emacs sources, Michael Heerdegen, 2018/10/29
- Re: Replace trivial pcase occurrences in the Emacs sources, Eric Abrahamsen, 2018/10/29
- Re: Replace trivial pcase occurrences in the Emacs sources, Eric Abrahamsen, 2018/10/29
- `pcase'/`case' implementation [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Garreau\, Alexandre, 2018/10/29
- Re: Replace trivial pcase occurrences in the Emacs sources,
Stefan Monnier <=
- Re: Replace trivial pcase occurrences in the Emacs sources, Eric Abrahamsen, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Garreau\, Alexandre, 2018/10/31
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Eli Zaretskii, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Eli Zaretskii, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Eli Zaretskii, 2018/10/31
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/31