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
always parenthesize the constraint-logical-or-expression in a requires-clause #2504
Comments
In the interest of clarity, for your two examples, you'd want
(with some indentation / line wrapping fixes) and
? |
Line-wrapping for the first one should be
or similar, but yes, that's what I'm looking for. |
If we do the indentation right, it seems to me that "always-parens" is a bit over the top. Maybe putting parens around the requires-expression is good enough; we should not have too many _requires-expression_s to start with. |
Editorial meeting:
|
We're starting to add requires-clauses to standard library functions, and they can quickly become pretty unreadable. For example, the Ranges proposal adds:
... which makes it look like there are multiple requires-clauses or something. Add to that the fact that some requires-clauses require parentheses anyway, and the weirdness of things like
void f() noexcept(blah) requires
see below;
(How much will I see below? Just a constraint, or other things that might go there, such as a function body or so?) ... and I think the only sensible and consistent formatting decision is to say that we always parenthesize the condition in a requires-clause. We should document this decision in the Wiki and apply it throughout the draft after merging the 2018-11 motions.
The text was updated successfully, but these errors were encountered: