-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[stdlib] Revise InlineArray documentation
#84978
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
Conversation
Update documentation for `InlineArray` to include examples with type sugar, reword to avoid certain jargon that may be unfamiliar to some standard library users, and incorporate additional details mostly drawn from the proposal text.
InlineArray documentationInlineArray documentation
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.
Thank you very much for working on this. I have a few suggestions, but overall you've greatly improved the documentation.
Should it be stated that the [count of Element] shorthand is preferred?
Shortened forms are preferred
Although the two forms are functionally identical, the shorthand form is preferred
Should the other example code in this file also be updated?
- /// InlineArray<4, Int> { 1 << $0 } //-> [1, 2, 4, 8]
+ /// [4 of Int] { 1 << $0 } //-> [1, 2, 4, 8]- /// InlineArray<4, Int>(first: 1) { $0 << 1 } //-> [1, 2, 4, 8]
+ /// [4 of Int](first: 1) { $0 << 1 } //-> [1, 2, 4, 8]|
Some of the doc comments on specific APIs could do with some follow-on revision. I've updated the two code examples you pointed out both to incorporate the shorthand and to illustrate their differences in terms of what the closure argument is. I'll leave the more prescriptive point about whether one should prefer one spelling or another for the type to others in the future. |
|
@swift-ci smoke test |
|
@stephentyrone Would you or one of the other code owners, and/or the documentation folks, like to weigh in before merge? |
|
Thanks, @xwu – these are great improvements! Re: shortened syntax – that preference is really only when used in type position. When used as an initializer, the documentation style is to prefer the type name (e.g. I've also requested a review from @amartini51 👍🏻 |
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.
Some minor clean-up, but this looks like an improvement to me.
Co-authored-by: Alex Martini <amartini@apple.com>
Co-authored-by: Alex Martini <amartini@apple.com>
Co-authored-by: Alex Martini <amartini@apple.com>
Co-authored-by: Alex Martini <amartini@apple.com>
Co-authored-by: Alex Martini <amartini@apple.com>
...adjust line wrapping to account for adoption of prior suggestions, and some minor edits.
|
@swift-ci smoke test |
This comment was marked as outdated.
This comment was marked as outdated.
|
@swift-ci smoke test Windows platform |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@swift-ci please clean smoke test macos platform |
Update documentation for
InlineArrayto include examples with type sugar, reword to avoid certain jargon that may be unfamiliar to some standard library users, and incorporate additional details mostly drawn from the proposal text.