[Top][All Lists]

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

Re: Replace trivial pcase occurrences in the Emacs sources

From: Alan Mackenzie
Subject: Re: Replace trivial pcase occurrences in the Emacs sources
Date: Wed, 24 Oct 2018 16:12:26 +0000
User-agent: Mutt/1.10.1 (2018-07-13)

Hello, Eli.

On Wed, Oct 24, 2018 at 18:03:26 +0300, Eli Zaretskii wrote:
> > From: Stefan Monnier <address@hidden>
> > Date: Tue, 23 Oct 2018 14:12:34 -0400

> > > I think so too, but it seems the majority of developers has a different
> > > option, at least in this (old) thread.

> > So I guess I'm gonna have to try and argue my case.
> > OK, here are the advantages I see for `cl-case`:

> FWIW, my main problem is not even with cl-case, it's with 'cond'.  It
> seems like we have some 'pcase' epidemic, whose first symptom is that
> people stop using 'cond' and start using 'pcase' instead.  A few
> examples:

[ .... ]

> My favorite is imap.el, which does something like the above in 3
> nested levels.  I will spare you the code, you can look it up.

> Is it because people are too lazy to write (eq a b) as part of 'cond'?
> Or is there something else I'm missing?  

> You may wonder why I'm bothered by such uses.  It's because people are
> evidently confused by 'pcase's arcane syntax, and therefore produce
> obfuscated code even in the simple usage.  For example:

[ .... ]

I'm somebody else who doesn't like pcase.  I don't like the way it has
purloined symbols which previously had a strong fixed meaning (``', `,',
`and', `or', and possibly more) and rendered them vague and with several
context dependent meanings.

For an Emacs Lisp beginner, `and' and `or' used to be easy to grasp,
once past the concept of short-circuit evaluation.  ``' and `,' were
somewhat more difficult.  Now, given the ambiguity introduced by pcase,
they are all much more difficult to understand.

The documentation for pcase is now good, but it still gives me a
headache to trundle through it.  Unless it's changed very recently, that
for pcase variants such as pcase-let is still inadequate.

I find pcase uses hard to understand, and definitely prefer cond.

[ .... ]

> We have dozens of such fragments in our codebase, which just makes the
> sources harder to read, especially for people who aren't fluent with
> 'pcase' (which seems to be the case with many of us).

> So I think we should begin by rewriting all of such uses as simple
> 'cond', and ask contributors not to use 'pcase' where a simple 'cond'
> will do.


Alan Mackenzie (Nuremberg, Germany).

reply via email to

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