Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Discuss upper bounds before self types in documentation#17827
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The explanation of self types uses upper bounds, so it makes senseto discuss them earlier.I also made some other minor documentation tweaks to improve clarity.
| Type parameters of generic classes may also have upper bounds, which | ||
| restrict the valid values for the type parameter in the same way. | ||
| .. _type-variable-value-restriction: |
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.
Since value restrictions and bounds are closely related concepts and users are likely to confuse them, would it be better to also move up this section to just below the section on bounds?
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 don't have a strong opinion. I didn't move it since self types, which are now covered in the following section, are closely related to upper bounds (probably one of the most common use cases for upper bounds), and self types are probably much more common than constraints/value restrictions in practice.
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.
Sounds good, we can leave this as is.
The explanation of self types uses upper bounds, so it makes sense to discuss them earlier.
I also made some other minor documentation tweaks to improve clarity.