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: Michael Heerdegen
Subject: Re: Replace trivial pcase occurrences in the Emacs sources
Date: Wed, 24 Oct 2018 17:48:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> I agree with the "trivial" part, but why cl-case and not cond (with
> the same "trivial" caveat)?

Just because `cl-case' fits better? - for an equivalent rewrite using
`cond', I need to define an extra local variable to bind the treated
value to, event a name for it (we speak about ~ 300 cases!) and all cond
branches would look equally like (eq VAR 'VAL).  Not an improvement in
readability in my mind.

There is a minority (around ~ 20 cases) that look like

  (pcase EXPR
    ('X1 foo1)
    ('X2 foo2)
    ...
    (VAR EXPR-USING-THE-VAR))

with a catchall last branch that already use a variable binding.  These
would fit a bit better to `cond', but as said, that's a minority.


Michael.



reply via email to

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