Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expr.prim.lambda] Split specification of lambda expressions into sub… #1158

Merged
merged 2 commits into from Mar 16, 2017

Conversation

jensmaurer
Copy link
Member

…sections.

Fixes #1155.

@jensmaurer
Copy link
Member Author

I have tried to restrain myself to reshuffling text and introducing subsection headings.

\tcode{()}.
The lambda return type is \tcode{auto}, which is replaced by the
type specified by the
\grammarterm{trailing-return-type} if provided and/or deduced from
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just "or" instead of "and/or"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unchanged text, just moved around. Not my invention.

@@ -788,7 +792,9 @@
q(); // OK: outputs \tcode{1a3.14}
\end{codeblock}
\end{example}
This function call operator or operator template is declared

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I cannot comment on unchanged code, so this comment is out of place.)

The example seems to be specific to packs only, not to the entire paragraph. What do you think of the following: In lines old-762/new-766, take the sentence "The invented type ..." out and end the paragraph after the next sentence, just before the example, Then put the removed sentence back at the start of the now new paragraph, followed by the example. That way the new paragraph concentrates on one specific detail (packs), together with example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, the example also has non-pack things, e.g. glambda at the top.
Second, "The invented type template-parameter ..." refers to the template-parameter introduced in the preceding sentence. Moving this to a separate paragraph, with something else in between, would lose the connection.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, the example is a good point. I wouldn't find losing the connection too worrying in general; I think it's acceptable for later things to refer to earlier things. That's more of a judgement call. But we can keep it as is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but if you read the intermediate sentence, it goes off on a tangent, and returning to the template-parameter later is odd.

@jensmaurer
Copy link
Member Author

Taking no action on the review comments, as explained above.

@zygoloid: You're next.

@jensmaurer
Copy link
Member Author

I've updated some cross-references to now refer to a more specific subsection, where appropriate.

@jensmaurer
Copy link
Member Author

No-change rebase.

@zygoloid
Copy link
Member

  1. [expr.prim.lambda]p2 seems out of place, and breaks the natural flow from p1 to p3. Maybe we can move it down next to where we talk about how these decl-specifiers map into properties of the closure type's operator()? Or if not there, then at least to after p5.

  2. I think [expr.prim.lambda]p4 would be better as the first paragraph of [expr.prim.lambda.closure], as it's a good summary of what we're about to describe in there, slightly tweaked to something like:

The type of a lambda-expression (which is also the type of the closure object) is a unique, unnamed non-union class type, called the closure type, whose properties are described below.

  1. The start of [expr.prim.lambda.capture] is quite jarring. We could do with an introductory sentence explaining what on earth a capture is before we get into the nitty-gritty details. Maybe something like:

The body of a lambda-expression may refer to automatic storage duration variables and the *this object of enclosing block scopes by capturing those entities, as described below.

  1. We might also want to consider moving the grammar description of explicit captures down into the captures subclause.

@jensmaurer
Copy link
Member Author

re 1: Moved normative sentence from [expr.prim.lambda]p2 to the start of [expr.prim.lambda.closure]p3. Moved example as a new paragraph to after [expr.prim.lambda.closure]p3.

re 2: Done.

re 3: Done. I'm not super-happy with the "*this object". I added "(if any)", since we might not be in a member function.

re 4: Why just the explicit captures? Seems like all of the capture grammar could go there. Done.

@jensmaurer
Copy link
Member Author

Subject: Re: editorial restructuring of [class.copy]
Date: Tue, 31 Jan 2017 14:56:02 -0500
From: William M. (Mike) Miller william.m.miller@gmail.com

[...]
The ones for expr.prim.lambda are involved enough that I think I'd like to have CWG take a look.

@jensmaurer
Copy link
Member Author

Uploaded to CWG wiki for Kona, as agreed with Mike Miller:
expr.prim.lambda

@zygoloid zygoloid added the cwg Issue must be reviewed by CWG. label Feb 4, 2017
@jensmaurer
Copy link
Member Author

CWG suggested to move the first sentence of closure types p4 to the general section and otherwise approved this change.

@jensmaurer
Copy link
Member Author

Rebased and implemented CWG guidance.

@jensmaurer jensmaurer removed the cwg Issue must be reviewed by CWG. label Feb 28, 2017
@zygoloid zygoloid added this to the C++17 milestone Mar 3, 2017
@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 16, 2017

@jensmaurer: Rebase, just to be sure?

@zygoloid zygoloid merged commit 09e4674 into cplusplus:master Mar 16, 2017
@jensmaurer jensmaurer deleted the b4 branch March 16, 2017 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants