2

Let's say I have this Protocol Buffers schema:

message Person{
  enum Height{
    UNDEFINED = 0;
    TALL = 1;
    SHORT = 2;
  }
  HEIGHT Height = 1;
}

Is it possible to have an empty string ("") instead of UNDEFINED ?

1 Answer 1

1

No, it is not. The enum name is used to generate a member in most (all?) languages, and that member is usually an identifier, and therefore needs a name. Due to how member resolution is defined for multiple enums in some languages (C++, cough), you might also want to prefix the names, so that you can have more than one UNDEFINED.

Personally I'd be more concerned by how ambiguous, overloaded, and limiting is a height option of "tall", "short", or "undefined".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.