After studying proto3 pretty carefully, I’ve come around quite a bit on these changes:
I believe adding JSON requires dropping unknown fields. You simply cannot preserve unknown fields and properly support multiple encodings. I’m less sure about replacing extension support with Any. Extensions have some ugly problems, but I feel the current spec for Any also has some real drawbacks. Removing field presence is a subtle issue, but I’m starting to suspect it was actually a very good change. It reduces the generated code and the workaround of using a single-element oneof is cleaner than it might sound. In essence, a single-element oneof is just a way to explicitly declare that you want to track presence for that field. And oneof is supported by proto2 now, so you can use that technique there as well. Finally, remember that proto2 is not going away: If proto2 assumptions are deeply baked into your systems, you can keep using it. protoc will continue to support it for a very long time. Cheers, Tim > On May 18, 2016, at 1:33 PM, Jeremy Ong <[email protected]> wrote: > > Big fan of 4, 5, 6, and 7. Huge un-fan of 2, and 3. I am mixed on 1 because I > love the removal of required fields, hate the removal of field presence. All > the changes I dislike are significant losses in functionality and break > compatibility with existing users of proto2 and I'd be interested to > understand why "ease of implementation" is good justification for this break > in compatibility and what I perceive to be a loss in functionality. > > On Wed, May 18, 2016 at 11:18 AM, 'Feng Xiao' via Protocol Buffers > <[email protected]> wrote: > > > On Wed, May 18, 2016 at 9:27 AM, Artem Kazakov <[email protected]> wrote: > +1 > Yes, a checklist would be extremely helpful. > > > On Friday, April 29, 2016 at 5:04:56 PM UTC-4, Kostiantyn Shchepanovskyi > wrote: > It would be nice to have a migration guide (checklist) somewhere, like: > > 1. All fields should be optional. > 2. Do not use custom defailt values. > 3. All enums should have first element with tag = 0. > 4. Do not use extension for anything except custom options. > > Something else? > In 3.0.0-alpha-1 release note there is a list of main proto3 changes: > The following are the main new features in language version 3: > > • Removal of field presence logic for primitive value fields, removal > of required fields, and removal of default values. This makes proto3 > significantly easier to implement with open struct representations, as in > languages like Android Java, Objective C, or Go. > • Removal of unknown fields. > • Removal of extensions, which are instead replaced by a new standard > type called Any. > • Fix semantics for unknown enum values. > • Addition of maps. > • Addition of a small set of standard types for representation of time, > dynamic data, etc. > • A well-defined encoding in JSON as an alternative to binary proto > encoding. > > > > > On Friday, April 29, 2016 at 1:18:12 AM UTC+3, Feng Xiao wrote: > > > On Tue, Apr 26, 2016 at 7:04 PM, Bo Gao <[email protected]> wrote: > suppose server side is updating into protobuf3, but client side still use > protobuf2, can then communicate will? > Yes, as long as you only use proto3 features, they are wire compatible. > > > -- > 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 post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > > > -- > 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 post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > > > -- > 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 post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > > > > -- > Jeremy Ong > PlexChat CTO > > -- > 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 post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
