-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add documentation for parameter packs #174
base: main
Are you sure you want to change the base?
Conversation
Confirmed the code examples here and in SE-0399 work as of Swift 5.9 (swiftlang-5.9.0.120.7)
Co-authored-by: Holly Borla <[email protected]>
the `repeat` operator must appear first. | ||
(So `repeat try each foo` or `repeat each try foo`) | ||
|
||
- All of the `each` expressions in a parameter-pack expression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having a similar reaction to the hyphen in parameter-pack
here, but am starting to wonder whether this is just my lack of familiarity with our formal documentation and this is some convention in certain circumstances? Because I am not seeing the hyphen used in parameter-pack
elsewhere in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In these cases 'parameter pack' is being used as a compound adjective, so it should be hyphenated. My favorite case is something like 'drag and drop' vs. 'drag-and-drop operation': https://support.apple.com/guide/applestyleguide/d-apsg7af4f5d0/1.0/web/1.0#:~:text=drag-and-drop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what's strange here is the overall term "parameter-pack expression". We should call it the "pattern expression".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(No opinion here either way, but there might be confusion with this other meaning of pattern: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/patterns , although 'pattern expression' isn't used in that context. Edit: That chapter does have 'expression pattern'.)
the whole line is duplicated once for each type. | ||
When you use `repeat` in the middle of a line (as an expression), | ||
it expands to make a tuple | ||
with one tuple element for each type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... only if you have done so within tuple parentheses?
Cherry-picked from swiftlang#206
Removed stray whitespace at end of lines. Restored line breaks for unchanged content. Split lines in new content at clause and sentence boundaries, instead of wrapping at 80 columns.
d2a7c35
to
be77ed9
Compare
be77ed9
to
6c2cd8f
Compare
Fixes: rdar://102835487