|
| From: | Dmitry Gutov |
| Subject: | Re: Instead of pcase |
| Date: | Fri, 1 Dec 2023 02:18:00 +0200 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
On 30/11/2023 05:37, Richard Stallman wrote:
[[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > I guess that's the point I wanted to underscore: that those pcase uses > are more-or-less optimal in terms of complexity (for its ultimate > goals), that in most cases it comes from the problem domain rather than > from the solution. I think the way you measure "complexity" is different from the way I measure it. I suspect that your measure does not count the complexity of learning `pcase' -- that it assumes the reader knows that already. That complexitu is what I am trying to eliminate. I also think that you measure "complexity" as the opposite of terseness, so that a couple of uses of `match-set' is in your view "added complexity". However, terseness is what makes `pcase' more complex.
You haven't posted your conversion, but I suspect it was not just less terse, but it also forced the programmer to repeat the same sets of information: first, in the predicate, to check that the value has a certain structure, and then in the matcher, to deconstruct the structure and create a set of variable bindings.
This repetition both adds verbosity and increases the chance to make a mistake in one of the two places. But once you eliminate it, I believe the result has to look like a more verbose pcase. Choosing an new syntax should be possible (indeed, somebody posted a link to a similar construct in Racket which is more wordy), but then those who don't like high-level constructs probably won't like it either.
| [Prev in Thread] | Current Thread | [Next in Thread] |