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

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

Hey Chris,

This will be a project spanning 17+ languages. To begin we should put together 
a reference implementation in C++ and create tests to verify proper function. 
Next we should add a second language, probably Java, and create tests for it. 
Then we will need to add a cross language test to ensure CPP clients work with 
Java servers and vice versa. When we think this much looks good we should 
document the new IDL definition for optional/default on the Apache Thrift web 
site. From there the other languages can follow suit, adding the feature along 
with internal and cross platform tests.

Due to the significance of this change I'd like to hear support from at least 
one other committer. 

Presently the keyword optional is ignored on fields with a default value unless 
they are explicitly unset. We are suggesting changing the meaning of optional 
combined with default, producing the following possible combinations of 
requiredness and default on struct fields:

||Serializer||optional||-||required||
||no default|if set: serialize *|serialize|serialize|
||default|if set to non default: serialize *|serialize|serialize|
_*otherwise do not serialize_


||Deserializer||optional||-||required||
||no default|if present: deserialize, if not present: do not set|same as 
optional|deserialize*|
||default|if present: deserialize, if not present: set to default|same as 
optional|deserialize*|
_*if not present throw TProtocolException_


Thoughts: Jake, Roger, Jens, Henrique, Ben, Carl, others?

-Randy

> 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