That why you have the Well Known Wrapper Types. They are included in the proto repo and live right next to the Timestamp and Duration:
https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/wrappers.proto On Thu, Aug 22, 2019, 10:43 Denis Feklushkin <[email protected]> wrote: > > > пн, 12 авг. 2019 г. в 23:51, Adam Cozzette <[email protected]>: > >> 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? > > >> As a result there shouldn't be has_foo() methods for singular primitive >> fields, and that is how Google's protobuf libraries work with proto3. There >> are has_() methods for embedded message fields, though (since those are not >> considered primitive fields). >> >> On Sun, Aug 11, 2019 at 11:08 PM Denis Feklushkin < >> [email protected]> wrote: >> >>> Hello! >>> >>> There is a Protobuff 3 implementation for D: >>> https://github.com/dcarp/protobuf-d/ >>> >>> Its author and I am diverged in the interpretation of the Proto3 >>> documentation: >>> >>> Is it necessary to implement something like has_foo() method as in >>> Googles's Protobuf C++ and Dart libraries or it is violates protocol >>> version 3 and leaved in official libraries only for backward compatibility? >>> >>> Can someone reasonably support this or that opinion? >>> >>> Discussion beginned here: >>> https://github.com/dcarp/protobuf-d/issues/21 >>> >>> Thanks! >>> >>> -- >>> 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 [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/protobuf/3f826c6a-c67e-4291-9b36-4922180dd7e3%40googlegroups.com >>> <https://groups.google.com/d/msgid/protobuf/3f826c6a-c67e-4291-9b36-4922180dd7e3%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/protobuf/CAHY2gWfYXmgLGmEnkLMRQzJC9dK_JeGAkUu03diV-tBobNEEZg%40mail.gmail.com > <https://groups.google.com/d/msgid/protobuf/CAHY2gWfYXmgLGmEnkLMRQzJC9dK_JeGAkUu03diV-tBobNEEZg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CALCMntt6CKGLWO%2Bbpgk5o1T2OQHjGQYc%2Bu%2BGBFVOEzDRpnC%3DJA%40mail.gmail.com.
