Subject: RE: bug#31311: 27.0; doc of `pcase'

From: Drew Adams <[email-masked]>
Date: Sun, 29 Apr 2018 15:59:24 -0700 (PDT)

1. Even just the first line of the doc string seems wrong:

 "Evaluate EXP and attempt to match it against structural
  patterns."

That should be something more like this:

 "Evaluate EXP and match _its value_ against structural
  patterns."

It does not match EXP ("it") against the patterns.  It
matches the result of evaluating EXP (against the patterns).

(And are the patterns necessarily "structural"?)

I'd say: "Evaluate EXP and match its value against CASES."

Even better would be to call the second arg PATTERNS.
 "Evaluate EXP and match its value against PATTERNS."

This is especially so because after that we talk only
about "patterns", never referring to CASES.

2. CODE is undefined (not specified).  We say only this:

 "The CODE expression corresponding to the matching
  pattern determines the return value."

So CODE must be an expression (Aha!).  That should be
said up front.

But what does "_corresponding_ to the matching pattern"
mean?

3. And just _how_ does the CODE expression that
corresponds to the matching pattern "determine the
return value"?

The rest of the doc string never mentions the return
value at all, AFAICT.  It mentions neither "return"
nor "value".

[There is one occurrence of "return", but it is about
something different: "(pred FUN) matches if FUN applied
to the object returns non-nil."]

The rest of the doc string (before the extra, unclear
generated text) just talks about the available standard
patterns and how matching is done - nothing about what
value is returned by the code resulting from `pcase'
macro expansion.

Even if we can't get someone super-knowledgable about
`pcase' to work on the doc, perhaps some rudimentary
improvement can be made.