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

Rename Nbt to BinaryNbt, and NbtFormat to Nbt, and add Nbt companion object for NbtTag serialization #39

Open
BenWoodworth opened this issue Apr 13, 2024 · 0 comments
Milestone

Comments

@BenWoodworth
Copy link
Owner

It would be nice to have default functionality common to binary/stringified NBT accessible with Nbt.[...], but the current NbtFormat/Nbt/StringifiedNbt naming doesn't work nicely with that.

Brief rationale:

  • Having Nbt.[...] for the API feels nicer from a naming perspective for basic un-configured serialization
  • This API could be added under the current (binary) Nbt class
    • but the companion object would implement NbtFormat, and it feels awkward/unexpected to be a different configuration type
  • This API could be added to the NbtFormat interface as a companion object
    • but it feels awkward/unexpected to have to write NbtFormat.encodeToNbtTag(serializer, value)
  • It feels better to me to have the Nbt class represent the general structure for the format, dealing with the in-memory representation and the NbtTag classes.
    • It would be an actual concrete & usable API, instead of just a parent interface for shared functionality.
    • Then, have more types of Nbt named according to what functionality they bring (BinaryNbt and StringifiedNbt).
  • This new naming means all general NBT API is named Nbt-, while binary/stringified API are BinaryNbt- and StringifiedNbt-, making the API easier to find through intellisense, and grouping code files more nicely when alphatized.
@BenWoodworth BenWoodworth added this to the v0.12 milestone May 5, 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

No branches or pull requests

1 participant