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

platform bytes class #204

Merged
merged 7 commits into from
Oct 11, 2023
Merged

Conversation

andrewparmet
Copy link
Collaborator

No description provided.


package protokt.v1

abstract class AbstractBytes internal constructor(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Seems to be the only way to share this code.

final override fun toString() =
value.contentToString()

internal companion object {
Copy link
Collaborator Author

@andrewparmet andrewparmet Oct 10, 2023

Choose a reason for hiding this comment

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

Used to hold common code in implementation companions rather than exposing a new public class. The same could be done with AbstractBytes but then the implementation would have to call into this object rather than inheriting the correct behavior. This pattern is already used in AbstractKtMessage and AbstractKtDeserializer, so it feels OK to be consistent with those.

@andrewparmet andrewparmet requested a review from ogolberg October 10, 2023 18:44
@andrewparmet andrewparmet merged commit 46a2873 into open-toast:main Oct 11, 2023
@andrewparmet andrewparmet deleted the platform-bytes-class branch October 11, 2023 17:30
ogolberg pushed a commit to ogolberg/protokt that referenced this pull request Jan 2, 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

Successfully merging this pull request may close these issues.

2 participants