Skip to content

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

@BenWoodworth

Description

@BenWoodworth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions