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: Achim Gratz
Subject: Re: Replace trivial pcase occurrences in the Emacs sources
Date: Thu, 1 Nov 2018 09:36:54 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Am 31.10.2018 um 17:20 schrieb Eli Zaretskii:
I think we can do better in this part:

     Evaluate BODY with bindings made by matching PATTERN to each
     element of LIST in turn.  PATTERN is a pcase pattern

I think using "matching" here is detrimental to understanding what's
going on, which is a destructuring binding that uses pcase patterns.
(The "matching" here is between the structures of PATTERN and elements
of LIST, but the usual meaning of "matching" in Emacs is different,
especially when "patterns" are mentioned nearby.  So we should not use
"matching" here, at least not without significant qualifiers, like
"structure matching" or somesuch.)

And this:

     Should the matching fail for any LIST element, the results are
     undefined.

should be reworded to explain that elements of LIST should have a
structure compatible with PATTERN, so that the destructuring works.

How about this:

PATTERN describes the expected structure of LIST and is used to establish bindings to corresponding elements of LIST during evaluation of BODY. Undefined behaviour results if the structure of LIST is different from that described by PATTERN.


--
Achim.

(on the road :-)




reply via email to

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