Skip to content

Provide default kotlinx serializers #8

@Lyxnx

Description

@Lyxnx

Attempting to serialize a basic unit doesn't work and requires a custom serializer. It would be nice if the project provided serializers out of the box by annotating each unit with @Serializable(with = ...).

Having had a look already, it would appear to not be as easy to implement as expected due to the nature of the Units class being abstract and all the other units being open resulting in open polymorphism which would require users to register the polymorphic serializer at runtime rather than being able to use it without any setup.
To get around this, a big API change would be needed to enforce closed polymorphism which I understand would break any custom external unit implementations.

Curious to know what you think as being able to serialize a system-agnostic unit is quite useful (eg user preferences and having to convert to a base unit manually)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions