[ 
https://issues.apache.org/jira/browse/THRIFT-2429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13974708#comment-13974708
 ] 

Randy Abernethy commented on THRIFT-2429:
-----------------------------------------

Sounds like there is support for adding this feature as stated above 
(https://issues.apache.org/jira/browse/THRIFT-2429?focusedCommentId=13970389&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13970389)
 with the following modification and clarification:

*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

For fields with this type of default value, the write implementation will test 
the value against the default in the struct write() method, if the value 
matches the default it will not be serialized.  The reader will initialize the 
field to the default value and overwrite it if the field is found in the stream.

Please chime in if you have lingering concerns. Otherwise I suppose we can 
start working on patches, tests and markdown for the web site.

[~davejwatson] Dave, you have been doing so much work on the code base I almost 
hate to ask, but it seems like you guys have a head start on at least the C++ 
front here. Any chunk of this you want to take on? I'd be happy to help any way 
I can.

[~chris5287] Chris, Do you have any chunk of this baked?

I have created sub-tasks for some of the languages. Please claim any you can 
make a patch for and add additional languages if you can supply a patch for 
them. All patches should provide tests that can easily be integrated with the 
make check and make cross. 


> 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)

Reply via email to