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

Johannes Martinsson commented on THRIFT-2189:
---------------------------------------------

If I understand Thrift correctly, there is no distinct {{union}} type, rather
a {{union}} is just a {{struct}} with exactly one field set/transferred?
Assuming that is the case...

In order to implement unions the code would have to keep track of which field
of an union that is currently the "active" field. In order to accomplish this
direct access to (Go) struct members would have to be prohibited, i.e. not
exported, and getter and setter methods would have to be used to access
fields.

With this bookkeeping in place the {{Write}} method would be able to send just
the set/active field, i.e. adhering to the union semantics. Similarly the
{{Read}} method when reading the one field would record which field was set.



Is anyone working on fixing this issue?

> Go does not support "union" type
> --------------------------------
>
>                 Key: THRIFT-2189
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2189
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>            Reporter: Jack L
>            Assignee: Jens Geyer
>             Fix For: 1.0
>
>
> Go thrift compiler does not support union types



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to