[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: combining cond and let, to replace pcase.
From: |
Michael Heerdegen |
Subject: |
Re: combining cond and let, to replace pcase. |
Date: |
Sun, 19 Nov 2023 14:52:31 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eli Zaretskii <eliz@gnu.org> writes:
> So we agree. Then arguments about how easy pcase is for some are not
> relevant, because this is not what this is about, right?
It is a part of the picture. How many these "some" are is another part.
And how harder it will become for those others to work with an
alternative tool is again another part.
And why is it always suggested that people not liking pcase are the norm
and those understanding it well are the deviation from the norm? We don't
know whether some different tool is actually easier to learn on average.
And we won't find a fair solution if we leave out half of the people.
> > This is an excellent analogy. Which one is the counterpart to `pcase'?
> > `rx' or the string form?
>
> The string, of course.
Interesting. `rx' is more similar to pcase in some regards - it's
extensible with macro definitions (rx-defmacro), has descendants (even
more macros: rx-let) and adds syntax to the language that is not Lisp.
> It isn't only that. It is also that the obscure and subtle nature of
> regexp strings makes it easy to make mistakes. Just look at the sheer
> number of regexp mistakes uncovered in our code base by Mattias
> Engdegård during the last year. It isn't an accident.
We have converters to convert between the two representations. Did we
look at mistakes that are typical for `rx' forms? It would be trivial
that we find less mistakes in `rx' forms when we only have a small
number of them compared to string regexps.
> > The amount of knowledge you need to remember, the amount of
> > documentation you need to consult, is the same.
>
> The rx notation is easier to read and interpret, at least for some,
> and I submit leads to fewer mistakes.
Yes, for some. For me, too, actually. Whether it leads to fewer
mistakes I don't know, both representations are really directly
isomorphic in this case.
> So no, I don't agree that it is "just the habit", and nothing else.
Personally I hate it if I have to read string regexps. But I guess some
of the pcase critics don't like `rx' and others don't like string
regexps.
It is also not trivial which of both leads to more programming errors,
and why.
It is not trivial that `pcase' is a larger hurdle than an alternative.
I'm not convinced this is not "just the habit" - but there seems a lot
of psychology involved here, too.
Michael.
- Re: combining cond and let, to replace pcase., (continued)
- Re: combining cond and let, to replace pcase., Gerd Möllmann, 2023/11/19
- Re: combining cond and let, to replace pcase., Eli Zaretskii, 2023/11/19
- Re: combining cond and let, to replace pcase., Gerd Möllmann, 2023/11/19
- Re: combining cond and let, to replace pcase., Eli Zaretskii, 2023/11/19
- Re: combining cond and let, to replace pcase., Joost Kremers, 2023/11/19
- Re: combining cond and let, to replace pcase., Eli Zaretskii, 2023/11/19
- Re: combining cond and let, to replace pcase., Joost Kremers, 2023/11/19
- Re: combining cond and let, to replace pcase., Eli Zaretskii, 2023/11/19
- Re: combining cond and let, to replace pcase., Michael Heerdegen, 2023/11/19
- Re: combining cond and let, to replace pcase., Eli Zaretskii, 2023/11/19
- Re: combining cond and let, to replace pcase.,
Michael Heerdegen <=
- Re: combining cond and let, to replace pcase., Eli Zaretskii, 2023/11/19
- Re: combining cond and let, to replace pcase., Michael Heerdegen, 2023/11/20
- Re: combining cond and let, to replace pcase., Eli Zaretskii, 2023/11/20
- Re: combining cond and let, to replace pcase., Michael Heerdegen, 2023/11/21
- Re: combining cond and let, to replace pcase., Michael Heerdegen, 2023/11/21
- Re: combining cond and let, to replace pcase., Dmitry Gutov, 2023/11/19
- Re: combining cond and let, to replace pcase., Eli Zaretskii, 2023/11/19
- Re: combining cond and let, to replace pcase., Dmitry Gutov, 2023/11/19
- Re: combining cond and let, to replace pcase., Gerd Möllmann, 2023/11/19
- Re: combining cond and let, to replace pcase., Tomas Hlavaty, 2023/11/19