Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 332 by ryan.br...@themoox.net: Allow for default values that are marked "set"
http://code.google.com/p/protobuf/issues/detail?id=332

I understand that the "default" values are not marked as set (as stated in issue 249) -- and thus not included in the serialization. I would find it useful to have an additional choice to have the default value marked as set so that it does get serialized. While I'm not familiar with the code be hide protobuf, I imagine this would be handled when converting the .proto to a native format, with no run-time penalty to anyone who does not use the feature.

I am trying to ensure that a message id is always set for a each message, without the user having to explicitly set the field to the default value every time they wish to send it. Currently, I find myself having to reflect into the message in my Send routine (which only receives a generic Message), fetch the default value, and then use the reflection methods again to set the value.

I've read that the preferred/suggested method for working with protobuf's non-intehitance-based design is to include all possible messages as fields within a "main" message, but I do not personally care for that approach.

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to