You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This provides some readability, but has a high cost: any options that have not been specifically implemented in the DSL are dropped. This includes both built-in options like packed=true (#2294) as well as all custom options(#1198).
To solve these problems, the generated code should embed a serialized descriptor. This will naturally preserve all options, and is easy to implement. eg.
Is it worth unblocking this by ignoring the rbs piece of this problem?
Who is currently reading the generated code and expecting it to be readable?
They need to understand how the DSL generates ruby classes
Whereas if they just read the proto directly, they need to understand how it maps to ruby
In either case, you need to understand some (very simple) mapping.
Seems like the proto -> ruby should be the default here. People interacting with the protos need to know proto anyway...
Could RBS be considered orthogonal? Fixing the generated code now, while backsliding on readability (but, per above, is that actually negative?), provides real benefits (like being able to use get proto options, which has been an ask for 6.5 years...).
Readability can then be "fixed" later with RBS.
Edit: Also, fwiw, the DSL also describes / is much closer to the proto itself, not the ruby classes, where as RBS would describe ruby. So the difference between the proto and DSL is super minimal today (imo), meaning I'm not sure there is a readability backslide at all... reading the DSL today is basically reading the proto...
Currently our generated code for Ruby uses a DSL to specify protos, eg:
This provides some readability, but has a high cost: any options that have not been specifically implemented in the DSL are dropped. This includes both built-in options like
packed=true
(#2294) as well as all custom options(#1198).To solve these problems, the generated code should embed a serialized descriptor. This will naturally preserve all options, and is easy to implement. eg.
This does make the generated code less readable though. So we should not do this until we are generating
.rbs
files: #9495Then we will have a world where:
_pb.rbs
provides a readable description of the protobuf interface_pb.rb
provides a compact, efficient description of the message, optimized for completeness and fast runtime loading.The text was updated successfully, but these errors were encountered: