[
https://issues.apache.org/jira/browse/THRIFT-2429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13979629#comment-13979629
]
Andrew Cox commented on THRIFT-2429:
------------------------------------
Aleksey, I think the reason for not having "optional" available for method
params is that not all languages have optional parameter semantics, especially
for parameters that aren't at the end of the list (if we required grouping the
parameters at the end of the list, I guess we could simulate this by generating
multiple overloads, but that assumes all languages have at least optional
parameter support *or* overloading, and Thrift supports a *lot* of languages so
that might be an invalid assumption...). So you'd either need to accept that
optional parameters would bring some inconsistency as to whether can avoid
passing the parameter or not (it would depend on language), or you'd have to
pass an instance of an optional container type that could be "unset" (at least
in some languages) in order to implement this consistently.
> 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)