emacs-devel
[Top][All Lists]
Advanced

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

Re: Replace trivial pcase occurrences in the Emacs sources


From: Eric Abrahamsen
Subject: Re: Replace trivial pcase occurrences in the Emacs sources
Date: Mon, 29 Oct 2018 16:18:30 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eric Abrahamsen <address@hidden> writes:

> Michael Heerdegen <address@hidden> writes:
>
>> Stefan Monnier <address@hidden> writes:
>>
>>> I'd rather keep it defined in terms of its differences w.r.t `dolist`,
>>> but if really needed, we could change the doc so it doesn't rely on
>>> `dolist`s own doc at all.
>>
>> I also don't think that would be an improvement.
>>
>>> +As in the case of `pcase-let', PATTERN is matched under the
>>> assumption +that it *will* match.
>>
>> What this leaves a bit unclear: It sounds like matching itself happens
>> differently (user visibly).  Or does it just mean "if PATTERN doesn't
>> match, the behavior [of pcase-dolist] is undefined/ this is not
>> allowed".
>
> I wonder if the manual shouldn't have a section somewhere making
> explicit the difference between `pcase' -- where a single value is
> matched against many patterns, and may fail to match altogether, and
> destructuring is only one of the use-cases -- and the other
> pcase-derived forms, where many values are matched against a single
> pattern, which *must* match (or error), and destructuring is kind of the
> whole point. Conceptually, they're pretty different.

In fact, when you think about it, the "case" nature of pcase is pretty
orthogonal to the "match/destructure" nature of pcase. If anything
fairly fundamental were to be done to refactor pcase, I wonder if it
shouldn't be to separate these two concerns. In a sense, we already have
`cl-case', why would we need another case-like structure? All we really
need are new _matching forms_, which could be used within `cl-case',
`dolist', `lambda'...



reply via email to

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