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

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

Some minor issues Facebook found in prod with this change: 

1) For C++->php/python, with default/optional, where the value is still the 
default - previously this would end up in php/python as an empty struct, if C++ 
does not serialize an empty struct it will result in None/null instead.  
2) For C++ where neither optional or required are set - for basic types we 
actually just check if it is still the default or not (but not for structs to 
avoid expensive checks), and if it is still the default, don't serialize.  This 
way you don't have to worry about using the setter, but you still get semantics 
as if you did.

I'll post the patch today for facebook's version of this for C++ as a starting 
point.

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