emacs-devel
[Top][All Lists]
Advanced

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

Re: Clarify `pcase' `rx' pattern doc


From: Michael Heerdegen
Subject: Re: Clarify `pcase' `rx' pattern doc
Date: Thu, 21 Jun 2018 13:13:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> >  (pcase-defmacro rx (&rest regexps)
> > -  "Build a `pcase' pattern matching `rx' regexps.
> > -The REGEXPS are interpreted as by `rx'.  The pattern matches if
> > -the regular expression so constructed matches EXPVAL, as if
> > -by `string-match'.
> > +  "Build a `pcase' pattern matching with `rx' REGEXPS.
>
> I don't like calling this "regexp".  Elsewhere in rx documentation we
> say either "regexps in sexp form" or just "form".  Using "regexp"
> might confuse the reader to think these are the "normal" regexp
> strings.

But hey, ehm - I didn't change this, I just upcased the argument name.

> > -  (let VAR FORM...)  creates a new explicitly numbered submatch
> > -                     that matches FORM and binds the match to
> > -                     VAR.
> > -  (backref VAR)      creates a backreference to the submatch
> > -                     introduced by a previous (let VAR ...)
> > -                     construct.
> > +  (let VAR REGEXPS...)  creates a new explicitly numbered
> > +                        submatch that matches the `rx' REGEXPS
> > +                        and binds the match to VAR.
>
> IMO, this change is for the worse: the original clearly indicated that
> FORM is the rx-style regexp, whereas the new text blurs this
> indication.

And here I just used the same name for the `let' argument, since it's of
exactly the same type as the argument of the `rx' pattern.

Even the normal `rx' macro (not the pcase macro) names its &rest
argument "REGEXPS" - so I think now what I suggested was just
consistent.  Of cause could we change all occurrences of "REGEXPS" to
"FORMS" or something better, but I think this is not in the scope of my
suggested commit.


Michael.



reply via email to

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