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: Eli Zaretskii
Subject: Re: Replace trivial pcase occurrences in the Emacs sources
Date: Wed, 31 Oct 2018 18:20:31 +0200

> Date: Wed, 31 Oct 2018 16:07:29 +0000
> Cc: Stefan Monnier <address@hidden>, address@hidden
> From: Alan Mackenzie <address@hidden>
> 
> > I will try, if no one beats me to it.
> 
> A beating attempt, first draught:
> 
>     (pcase-dolist (PATTERN LIST) BODY...)
> 
>     Loop over a list.
> 
>     Evaluate BODY with bindings made by matching PATTERN to each
>     element of LIST in turn.  PATTERN is a pcase pattern, the
>     matching being done as described in `pcase'.  The return value is
>     not significant.
> 
>     Should the matching fail for any LIST element, the results are
>     undefined.
> 
>     See also `dolist'

Thanks.

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.



reply via email to

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