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

Provide default kotlinx serializers #8

Open
Lyxnx opened this issue Oct 5, 2024 · 0 comments
Open

Provide default kotlinx serializers #8

Lyxnx opened this issue Oct 5, 2024 · 0 comments

Comments

@Lyxnx
Copy link

Lyxnx commented Oct 5, 2024

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)

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