I realise that the style guide for Protocol Buffers requires that *enum*
values be in UPPER_CASE but I am finding that this is increasingly
conflicting with more modern styles such as C#
<https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/enumeration-types>,
C++11
<https://stackoverflow.com/questions/8005671/namespace-level-enums-in-c>,
TypeScript <https://www.typescriptlang.org/docs/handbook/enums.html> and
maybe others that I am less familiar with.
So I find myself increasingly having to add shims manually like this:
enum MyTypes {
None = ProtoBufTypes.PT_UNSPECIFIED,
Elephant = ProtoBufTypes.PT_ELEPHANT,
Banana = ProtoBufTypes.PT_BANANA,
Motor = ProtoBufTypes.PT_MOTOR,
Alfafa = ProtoBufTypes.PT_ALFAFA
}
in order to conform to the style guides for the rest of my (non-protobuf)
code, which naturally introduces a code maintenance issue that I would
rather avoid.
If you don't want to "modernise" the Google Style guide to allow CamelCase
for enums, may I suggest that you add an option to protoc that tells it to
use the enums exactly as I supply them and not to change the casing? Is
there something inside protoc that will break if you don't use
all-uppercase?
--
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/77d35ce4-14de-48a7-85e9-21108c826949%40googlegroups.com.