You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As regards the removal of presence logic for primitives in proto3, I wonder if you could consider supporting nullable<T>.
It would be like map<K,V>, but for primitives that need presence logic. For example, these messages could be effectively equivalent:
message A {
nullable<string> name = 1;
}
message B {
message NullableString {
string value = 1;
}
NullableString name = 1;
}
I'd certainly be open to a better name. Perhaps optional<string>, if it isn't too confusing, since optional means something somewhat different in proto2.
The text was updated successfully, but these errors were encountered:
There will be well know types added in the default protobuf runtime in the next release. See the wrappers.proto: https://github.com/google/protobuf/blob/96e379ff8bc6907d044c62c1381b8e5a793b6a7a/src/google/protobuf/wrappers.proto
It provides field presence info for primitive fields without introducing new syntax. Runtime libraries that support well know types may choose to use a more efficient representation for the messages (or provide additional functions). Binary format will be compatible as if they are normal wrapper messages.
As regards the removal of presence logic for primitives in proto3, I wonder if you could consider supporting
nullable<T>
.It would be like
map<K,V>
, but for primitives that need presence logic. For example, these messages could be effectively equivalent:I'd certainly be open to a better name. Perhaps
optional<string>
, if it isn't too confusing, sinceoptional
means something somewhat different in proto2.The text was updated successfully, but these errors were encountered: