[
https://issues.apache.org/jira/browse/THRIFT-2429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13970389#comment-13970389
]
Randy Abernethy commented on THRIFT-2429:
-----------------------------------------
I'd like to make a new proposal. We have seen three points of view here, all
with merit in my mind.
# Defaults are problematic and you should avoid them. Those with this
philosophy can use Thrift without default values in their IDL today.
# Defaults are ok but they should always be written when serializing. This is
how Thrift '=' defaults work today, so those with this philosophy can also use
Thrift as is today.
# Defaults are ok but they should not be serialized and should be set by the
reader.
Case 3 (the reason for this issue) is not yet supported. I would like to
propose the following:
*Writer Default (Thrift today, unchanged)*
The field specification below should be read as: "x defaults to 5 and is
serialized by the writer"
bq. 1: i32 x = 5
*Reader Default (new Thrift IDL construct)*
The field specification below should be read as: "x defaults to 5 and is not
serialized by the writer"
bq. 1: i32 x ~ 5
This will allow everyone to use Thrift the way that they think best and will be
100% backward compatible with current Thrift implementation.
Thoughts?
> 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)