Giter VIP home page Giter VIP logo

Comments (10)

ola-rozenfeld avatar ola-rozenfeld commented on September 24, 2024

I agree that in C++ this is very annoyingly confusing. Moreover, the same problem exists in Python and Go as well, only Java does it right. But I think we should either make this change for all the enums on this proto, or none. The same problem applies to ExecuteOperationMetadata.Stage and DigestFunction, although to a lesser degree because those ones have more self-explanatory names.

Another good thing about your proposal is that it is not a breaking change. I mean, sure, some code would need to change, but it could be done independently in all clients and servers, and the wire format is the same.
So I like it -- I would only switch the name Enum for Value, just in case (don't want to use reserved words).

@bergsieker WDYT?

from remote-apis.

ulfjack avatar ulfjack commented on September 24, 2024

It'll make Java code more annoying, though. Maybe this should be filed against protobuf?

from remote-apis.

jmillikin-stripe avatar jmillikin-stripe commented on September 24, 2024

@ulfjack I expect there's a zero percent chance of upstream protobuf changing its enum scoping semantics at this point. That ship sailed ten years ago.

from remote-apis.

ola-rozenfeld avatar ola-rozenfeld commented on September 24, 2024

Agreed. Also, as annoying goes, I much prefer annoyingly slightly more verbose (SymlinkAbsolutePathStrategy.Value.ALLOWED) to annoyingly misleading (CacheCapabilities::ALLOWED).

from remote-apis.

ulfjack avatar ulfjack commented on September 24, 2024

It might still be worth letting them know. They did some rather large changes for proto3, and they might be thinking about this already.

from remote-apis.

ola-rozenfeld avatar ola-rozenfeld commented on September 24, 2024

Do you prefer that we make this change now, and fix the compile of existing clients/servers, or postpone till the next API version?
I'd prefer to just do it.

from remote-apis.

jmillikin-stripe avatar jmillikin-stripe commented on September 24, 2024

IMO: just do it. This change is backwards-compatible on the wire, and waiting longer only increases the number of clients that would need to update.

from remote-apis.

buchgr avatar buchgr commented on September 24, 2024

Did anyone reach out to protobuf in the meantime? @jmillikin-stripe is your proposal a recommended / best practice solution?

from remote-apis.

ola-rozenfeld avatar ola-rozenfeld commented on September 24, 2024

from remote-apis.

jmillikin-stripe avatar jmillikin-stripe commented on September 24, 2024

The prefix solution is the traditional way, used since proto1 to match C++ style. Wrapping enums in a message only started once protobuf was ported to languages where enum value symbols are namespaced under the type.

My preference is for the wrapper message because LONG_SCREAMING_SNAKE_CASE doesn't match contemporary style in any major language. Even C++ has namespaced enum value symbols nowadays.

from remote-apis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.