[
https://issues.apache.org/jira/browse/THRIFT-1767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13509975#comment-13509975
]
Jens Geyer edited comment on THRIFT-1767 at 12/4/12 9:27 PM:
-------------------------------------------------------------
I'm not so sure ...
{code}
Union {
1 : i32 one,
2 : i32 two = 3
}
{code}
would be ok. Only
{code}
Union {
1 : i32 one = 4,
2 : i32 two = 3
}
{code}
would produce something unexpected. Depending on the impl either more than one
field would be set, or only the last value. But yes, I agree that a warning
should be emitted.
Sidenote: The Java impl indeed seems not to use the Defaults.
was (Author: jensg):
I'm not so sure.
{code}
Union {
1 : i32 one,
2 : i32 two = 3
}
{code}
Would be ok. Only
{code}
Union {
1 : i32 one = 4,
2 : i32 two = 3
}
{code}
would produce something unexpected. Depending on the impl either more than one
field would be set, or only the last value. But yes, a warning should be
emitted.
> unions can't have required fields (Delphi)
> ------------------------------------------
>
> Key: THRIFT-1767
> URL: https://issues.apache.org/jira/browse/THRIFT-1767
> Project: Thrift
> Issue Type: Bug
> Components: Delphi - Compiler
> Affects Versions: 0.8, 0.9
> Reporter: Jens Geyer
> Assignee: Jens Geyer
> Fix For: 1.0
>
> Attachments: THRIFT-1767_union_clear_value_experimental.patch,
> THRIFT-1767_unions_cant_have_required_fields.patch
>
>
> Required fields within unions should be treaten as optional, the union
> construct would not make much sense otherwise.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira