[ https://issues.apache.org/jira/browse/THRIFT-2429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13975926#comment-13975926 ]
Randy Abernethy commented on THRIFT-2429: ----------------------------------------- Hey Aleksey, I understand and respect your view. So it sounds like we have two contenders for the implementation of the no-serialize-default feature. *1) Use =? for reader side defaults* PROS: - Easy to explain, =? always means do not serialize the default (though implementations may serialize defaults as a fall back). - Doesn't tamper with = defaults, leaving them backward compatible and consistent (= maintains its "always serialize the default" meaning) - Lets the user choose any combination of requiredness and default style they want (can be applied to normal and optional in particular) CONS: - May be viewed as inconsistent with required fields - Introduces a new operator in the IDL - Enables (keeps) combinations that are only valuable in some fairly exotic cases *2) Use optional fields with = default values as reader side default* PROS: - Adds no new IDL syntax - Creates a valuable feature out of the otherwise fairly redundant combination of optional fields with default values (which are currently almost exactly like normal fields with default values) CONS: - Leaves no way to get reader side default functionality with normal requiredness - Causes = to work differently with different requiredness, making the default value function harder to understand Aleksey makes a good case for optional with = default. I am on the =? side of the fence but I will happily support the optional+default choice if that is what the cognoscenti prefer (the spread is pretty narrow). Please chime in if you see other pros/cons or disagree with those above. Would be good if we could make a call on this and move forward in the short term, so voice your opinion if you have a preference. Best, Randy > Provide option to not write default values, rely on receiver default > construction instead > ----------------------------------------------------------------------------------------- > > Key: THRIFT-2429 > URL: https://issues.apache.org/jira/browse/THRIFT-2429 > Project: Thrift > Issue Type: Improvement > Components: C++ - Compiler > Affects Versions: 0.9.1 > Reporter: Chris Stylianou > Assignee: Randy Abernethy > Labels: default, optional, required > > Would there be any objections to a patch that does not write default values > (essentially the same logic as the optional attributes). This obviously > relies on the receiving application using the same IDL version to ensure the > defaults used on object construction match the senders. -- This message was sent by Atlassian JIRA (v6.2#6252)