[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: Dmitry Gutov
Subject: Re: Replace trivial pcase occurrences in the Emacs sources
Date: Thu, 1 Nov 2018 02:07:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:64.0) Gecko/20100101 Thunderbird/64.0

On 31.10.2018 22:03, Stefan Monnier wrote:
A thing can be called "destructuring" if it destructures something.
It's like a "flying carpet": the carpet that flies.  But in our case
the patterns don't destructure anything, they are a means for

And let's not forget that what I used this term currently is to talk
about the specific way pcase patterns are used within pcase-let
(i.e. the way pcase-let and friends skip the tests to verify that the
pattern does match).

That part of the explanation is pretty counter-intuitive to me. I mean, I get what it's saying (pcase-let skips certain checks), but that's not a property of a pattern (which is a certain form), so the phrase "destructuring pattern" (which, in my mind, should just describe the pattern) shouldn't imply a particular aspect of its use.

The way I think of the situation is pcase performs both the structure check and destructuring, and pcase-let only performs destructuring. But destructuring is present in both cases and it's a property of the pattern (and maybe of the input data if the pattern includes an "(or").

So maybe we should just say "a pattern used to destructure" to clarify
that it's not a property of the pattern but of the way it's being used.

Maybe we shouldn't try to explain that through saying that patterns exhibit a certain property in this situation, and explain that purely in terms of behavior of certain macros (pcase-let and pcase-dolist, IIRC)?

reply via email to

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