Alfred Kwan wrote:
> There are more than just the rationale of "most users don't use the field
> presence logic much".
> If I understand it correctly, Google wants to make proto3 available to
> other languages (e.g. Ruby) where there is no concept of default values,
> meanwhile 'has_foo()' relies on the default value, which means everything
> is optional now
If I understand the removal of field presence logic, this means there is
no way to tell the difference between a zero value and the field not
being present. E.g., if I have a field like (in proto2 syntax, from a
real .proto file):
// This is the number of seconds since the UNIX epoch.
optional uint64 response_time_sec = 12;
Without field presence logic, I can't tell the difference between the
field being unset, and the zero value (i.e., the value corresponding to
Thu Jan 1 00:00:00 UTC 1970, in this case).
I don't see how default values enters into it.
> and these "hazzers" logics have to go away.
Google says, "we will continue to support proto2 for a long time."
--
Robert Edmonds