You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Brent Pearson (JIRA)" <ji...@apache.org> on 2014/08/05 02:43:12 UTC

[jira] [Commented] (THRIFT-2429) Provide option to not write default values, rely on receiver default construction instead

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

Brent Pearson commented on THRIFT-2429:
---------------------------------------

"Given that the fields in question will be optional, setters and getters will need to be used
Non optional fields of a struct are usually set directly like this:
myObj.x = 5;
as opposed to:
myObj.__set_x(5);
The later is required to set an optional field in C++ (and many other languages) so any automatic data binding or other users of optional/default fields would need to be modified to use the setter."

Is this documented anywhere? I just spent a couple hours trying to figure out why values getting set weren't being sent and finally figured out that taking out the "optional" modifier fixed it, then found this page via google. Either the documentation on Thrift is nearly non-existent or I can't find it.

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