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

Dave Watson commented on THRIFT-2429:
-------------------------------------

fbthrift branch implemented this almost exactly, see terse_writes option - 

https://github.com/facebook/fbthrift/blob/master/thrift/compiler/generate/t_cpp_generator.cc#L2844

We could merge it in. 

It basically checks if the C++ struct hasn't changed from the default value, 
and if it hasn't, doesn't serialize it.  The one 'gotcha' is for languages like 
php/python where the default struct is None/null and not a struct with unset 
fields - isset may be wrong in this case if you make calls c++ -> php -> c++ 
again (see the 'safe' option in fbthrift branch)

> 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
>              Labels: thrift
>
> 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