Michael Park created MESOS-2710:
-----------------------------------
Summary: Propose a style guide for protobuf field comparison.
Key: MESOS-2710
URL: https://issues.apache.org/jira/browse/MESOS-2710
Project: Mesos
Issue Type: Bug
Components: general
Reporter: Michael Park
h3. Background
[MESOS-2309|https://issues.apache.org/jira/browse/MESOS-2309] surfaced an issue
where the comparison logic for an optional protobuf field {{shell}} of the
{{CommandInfo}} message resulted in very unintuitive behavior as the user. In
[r31904|https://reviews.apache.org/r/31904/], we took a general approach to
simply perform the comparison via {{left.field() == right.field()}} as opposed
to {{left.has_field() == right.has_field() && (!left.has_field() ||
left.field() == right.field())}} across the codebase.
h3. Problem
The problem here is that this approach effectively makes {{optional}} useless
for all its intents and purposes. By omitting the {{has_}} checks, we've
collapsed the *None* state and the *default-constructed* state. On the other
hand, the intuitive behavior of {{optional int32 n = 1; [default = 42]}} is
such that if the user does not specify a value, the value of 42 will be passed
and used.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)