Skip to content

update: first update for serialization documentation restructuring #2978

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daniCsorbaJB
Copy link

This PR is for the first batch of documentation updates for KT-66330

Additional PRs will be opened on this one.

Copy link
Contributor

@pdvrieze pdvrieze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to be accurate in how serialization works. The "intermediate data" representation is misleading, an intermediate format is fundamentally impossible (even without supporting format specific escape hatches such as JsonPolymorphicSerializer)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling the middle step Primitives is misleading (as this is not Kotlin/Java primitive types). Instead the middle steps are actually serialization library calls (with a given set, including primitive types, but also supporting structures and "special" types).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @pdvrieze - thank you for your comments 💯 - we are still in the review process for these updates (just a draft PR at this point), but we will take a look at your feedback during the review

Comment on lines +12 to +13
1. Serialization: Objects are transformed into a sequence of their primitive values.
This universal process varies depending on the object and is managed by a serializer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is misleading. Serialization translates objects to a sequence of encoder calls. There is no intermediate format, and such a format would not actually work (many formats allow for "special casing").

Comment on lines +18 to +19
The reverse process involves parsing the input format, decoding the primitive values, and then deserializing the resulting
stream into objects.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reverse process involves the decoder invoking the input format to guide it in parsing the input (there is no intermediate format and that cannot exist - note that formats may not allow parsing without the knowledge of specific data structures (generally non-self-describing binary formats)).


## Kotlin serialization libraries

The `kotlinx.serialization` library offers support for all platforms, including JVM, JavaScript, Native.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worthwhile to clarify more that the serialization library provides the format agnostic infrastructure. Then the -json and -cbor libraries are format implementations (they are fundamentally different and are independent even though first-party).

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