--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/3f826c6a-c67e-4291-9b36-4922180dd7e3%40googlegroups.com.
Proto3 doesn't have a concept of field presence for singular primitive fields, so for example there is no difference between an integer field set to 0 and that same field being unset entirely.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CAHY2gWfYXmgLGmEnkLMRQzJC9dK_JeGAkUu03diV-tBobNEEZg%40mail.gmail.com.
пн, 12 авг. 2019 г. в 23:51, Adam Cozzette <acoz...@google.com>:Proto3 doesn't have a concept of field presence for singular primitive fields, so for example there is no difference between an integer field set to 0 and that same field being unset entirely.But in this case it will be impossible to distinguish absence of a field (for example, when changing message format) from the fact that the field is zero and this zero is one of legitime field value?
Is there any explanation/rationale for this?
On Thu, Aug 22, 2019 at 1:43 AM Denis Feklushkin <feklushk...@gmail.com> wrote:пн, 12 авг. 2019 г. в 23:51, Adam Cozzette <acoz...@google.com>:Proto3 doesn't have a concept of field presence for singular primitive fields, so for example there is no difference between an integer field set to 0 and that same field being unset entirely.But in this case it will be impossible to distinguish absence of a field (for example, when changing message format) from the fact that the field is zero and this zero is one of legitime field value?That's true, there is no way to distinguish between a field being absent and being explicitly set to zero.Is there any explanation/rationale for this?Proto3 was designed before I joined the protobuf team, but I believe the main rationale was to simplify implementations and in particular to enable an open-struct style implementation such as what Go protobuf did. The open-struct idea is that you can store fields in a simple struct and just access them directly without the need for a separate bit array indicating field presence.