-
Notifications
You must be signed in to change notification settings - Fork 13
Add strongly typed messages in protocol #114
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1742c7b to
a71ee1f
Compare
fb0048f to
5426bc4
Compare
DrTon
reviewed
Dec 18, 2024
| ``` | ||
|
|
||
| ## Generate messages | ||
| ## Generating messages |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generating types and protocols maybe?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The introduction of hard types for messages in the
generated protocol is dictated by the ease of use.
Attempting to have a message data (type) and
pure message (type_id + proto_id) did not result
in an ergonomic API. Instead message had to be
always provided alongside the type. Messages
inherit from data types as it is much easier to create
and send them this way. Messages remain purely
informational and hold no data on their own outside
of the data inherited from the type they are based on.
The introduction schema hash (TYPE::HASH in C++,
serializer.type_hash() in Python and ["hash"] in json)
is dictated by the need to support type consistency
checks of serialized messages.
Since the extraction of types from protocols the latter
became just logical grouping of types. In fact the name
or id of the protocol is not needed to successfully
serialize / deserialize a message.