emacs-devel
[Top][All Lists]
Advanced

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

Re: Instead of pcase


From: Eric Abrahamsen
Subject: Re: Instead of pcase
Date: Sun, 19 Nov 2023 11:31:39 -0800
User-agent: Gnus/5.13 (Gnus v5.13)

Dmitry Gutov <dmitry@gutov.dev> writes:

> On 19/11/2023 18:02, Barry Fishman wrote:
>> On 2023-11-19 13:23:17 +01, Michael Heerdegen wrote:
>>> So, the advantage would be more of a psychological kind: you have normal
>>> Lisp function calls, but structurally you have the same thing, and you
>>> have to remember exactly the same set of details.  The complexity comes
>>> from the task, not from the implementation.
>> I submit that the opposite is true,  the complexity is in its
>> implementation, not the task.
>> In languages like Haskell this is expressed in a very simple way, so
>> the
>> task is not in itself hard to understand.
>
> Haskell is notable for using the same (or similar) syntax for
> destructuring as it uses for constructing expressions.
>
> pcase actually follows that practice with backquotes and commas.
>
> And in both matching and destructuring are done in the same expression
> (the presence of the latter is determined by whether a pattern
> contains variable bindindgs).

+1, thanks for stating this so clearly in this and your earlier message.

I agree that once you introduce guards/predicates, pcase gets ugly fast,
but as you and Michael say, the core conceit is already as simple as it
could be, and is deeply consonant with the already-understood meaning of
the backquote.




reply via email to

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