-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
proto3 no-longer generates pointers to fields #15
Comments
That's working as intended, and a deliberate choice for proto3. You simply aren't supposed to differentiate fields explicitly set to their zero value from fields not touched at all. |
@dsymonds - unless I'm missing something, the README still refers to the generation of pointer fields. Is there somewhere with updated documentation for proto3? |
This seems the most relevant. |
I'll update the README to mention the difference. |
@dsymonds - thanks |
Documentation still says "Non-repeated fields are pointers to the values; nil means unset. That is, optional or required field int32 f becomes F *int32." It it possible to specify that pointers be used. It really saves a lot of pain. |
The documentation could be clearer, but below the bullet point list it says:
|
I would love to hear an explanation of the design decision to no longer allow primitives to be expressed as pointers. There are many real world cases in which (for let's say, an int64) a |
The Go team is not responsible for the protobuf language design. As such, we are unable to answer questions about motivation. Please redirect questions towards protocolbuffers/protobuf#1606 |
In proto2 fields were generated as pointers, which allowed us to check if a field was specified or not. This no longer seems to be the case. For example:
proto2:
gives
proto3:
gives
Is this the expected behavior, and if so how are we supposed to differentiate a client making a call with
SortOrder = 0
vs one making a call and not specifying theSortOrder
?The text was updated successfully, but these errors were encountered: