[go: up one dir, main page]

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

Discuss upper bounds before self types in documentation #17827

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

JukkaL
Copy link
Collaborator
@JukkaL JukkaL commented Sep 25, 2024

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.

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.

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:
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Member

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.

@JukkaL JukkaL merged commit 6336ce1 into master Sep 26, 2024
2 checks passed
@JukkaL JukkaL deleted the generics-docs-bounds branch September 26, 2024 09:07
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.

3 participants