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

Jens Geyer commented on THRIFT-2429:
------------------------------------

{quote}
(the {{=?}} operator) should be read as: "x defaults to 5 and is not serialized 
by the writer"
{quote}

New proposal: x defaults to 5 and _may_ not be serialized by the writer, _if 
the current value is equal to the default_.

I'd prefer the "may not" over "is not", because (a) this way we leave room for 
compatibility (a naive implementation would just behave as it is now) and (b) 
an writer may indeed decide to write even the default value for some reason, 
e.g. the cost of checking a complex default may be too high. I can have 
defaults that are structs, containing other structs and maps, who in turn 
contain lists ... etc.



> 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