Skip to content

Conversation

@MrHell228
Copy link
Contributor

@MrHell228 MrHell228 commented Apr 6, 2025

SpongeAPI | Sponge

Changes:

  • Adds DefaultedTag which allows to remove hardcoded registries from Taggable and keep convenient Taggable#is(Tag) (which was changed to #is(DefaultedTag)).
  • All generated built-in tags are now DefaultedTags instead of just Tags.
  • Taggable#tags requires DefaultedRegistryType
  • Changes return type of Taggable#tags and Registry#taggedValues to Stream.

@aromaa
Copy link
Member

aromaa commented Jun 8, 2025

Removed some defaulted methods because their time complexity was O(n) and that's not appropriate. The implementation can do more efficient operation under the hood and I did not feel like we want to promote the fact that tags are looked up from the registry too much and just try to hide it in most cases.

Reduces the API surface a bit too before we add too many ways to do the same thing.

@aromaa
Copy link
Member

aromaa commented Jun 8, 2025

Also mentioning that I feel like its natural that the defined tags are part of the registry itself, hence why DefaultedTag<T> feels right. However that the instances don't hold their tags but need to lookup it from the registry is not something we would like to promote.

@aromaa aromaa merged commit 7abe65b into SpongePowered:api-14 Jun 8, 2025
4 checks passed
@MrHell228 MrHell228 deleted the api-14-defaulted-tag branch June 9, 2025 13: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.

2 participants