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

Seal the HasContext trait #280

Merged
merged 1 commit into from
Feb 21, 2024
Merged

Seal the HasContext trait #280

merged 1 commit into from
Feb 21, 2024

Conversation

notgull
Copy link
Contributor

@notgull notgull commented Feb 6, 2024

In the current iteration of this crate, a new breaking change is needed
every time a method is added to the HasContext trait. This is because
a downstream crate could theoretically provide its own implementation of
HasContext, and would need to accommodate for these new methods.
However, most users of glow do not implement the HasContext trait
and only act as consumers of it. This means that downstream crates have
to constantly update glow to take advantage of new updates, which can
be annoying.

This commit makes it so it is impossible to implement the HasContext
trait outside of this crate. It does this by making a crate-private
Sealed trait that is needed for implementors of HasContext. This
makes it so methods can be freely added to HasContext without needing
to release a new breaking version of glow.

The goal of this change is to make glow v1.0.0 possible. With this
change it should be possible to release a stable API, assuming none of
the other APIs need to be changed or removed in any way.

The downside of this change is that it becomes impossible to implement
HasContext outside of this crate. I would be genuinely shocked if any
such implementations existed

In the current iteration of this crate, a new breaking change is needed
every time a method is added to the `HasContext` trait. This is because
a downstream crate could theoretically provide its own implementation of
`HasContext`, and would need to accommodate for these new methods.
However, most users of `glow` do not implement the `HasContext` trait
and only act as consumers of it. This means that downstream crates have
to constantly update `glow` to take advantage of new updates, which can
be annoying.

This commit makes it so it is impossible to implement the `HasContext`
trait outside of this crate. It does this by making a crate-private
`Sealed` trait that is needed for implementors of `HasContext`. This
makes it so methods can be freely added to `HasContext` without needing
to release a new breaking version of `glow`.

The goal of this change is to make `glow` v1.0.0 possible. With this
change it should be possible to release a stable API, assuming none of
the other APIs need to be changed or removed in any way.

The downside of this change is that it becomes impossible to implement
`HasContext` outside of this crate. I would be genuinely shocked if any
such implementations existed.

Signed-off-by: John Nunley <[email protected]>
@notgull
Copy link
Contributor Author

notgull commented Feb 7, 2024

macOS failure appears to be a spurious network error

@notgull
Copy link
Contributor Author

notgull commented Feb 17, 2024

@grovesNL When do you think you'll be able to review this?

Copy link
Owner

@grovesNL grovesNL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me, thank you!

@grovesNL grovesNL merged commit f7ad057 into grovesNL:main Feb 21, 2024
5 of 6 checks passed
@notgull notgull deleted the seal branch February 21, 2024 03:04
@chyyran chyyran mentioned this pull request Sep 4, 2024
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.

2 participants