[
https://issues.apache.org/jira/browse/THRIFT-2232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13804653#comment-13804653
]
Jens Geyer commented on THRIFT-2232:
------------------------------------
{quote}
This is because an empty list serializes as "" and is thus indistinguishable on
the wire from an absent list.
{quote}
Thrift can, and so Go should.
{quote}
How does the thrift wire format distinguish between a present list that has no
elements and an absent list, though?
{quote}
The basic sequence is as follows:
{code}
WriteStructBegin
WriteFieldBegin
WriteListBegin
foreach elm in list do WriteElement
WriteListEnd
WriteFieldEnd
// more fields ...
WriteFieldStop
WriteStructEnd
{code}
I agree on the pointer/fields approach.
If any other Go-er around has an opinion on this, please speak/post.
> IsSet* broken in Go
> -------------------
>
> Key: THRIFT-2232
> URL: https://issues.apache.org/jira/browse/THRIFT-2232
> Project: Thrift
> Issue Type: Bug
> Components: Go - Compiler
> Reporter: Ben Sigelman
> Labels: isset
> Fix For: 0.9.2
>
>
> The various generated IsSetXYZ() methods just check for magic values of their
> respective fields. This is obviously broken, and also diverges from the
> implementation in other languages.
> I am willing and able to fix this myself, but I don't want to start on any
> impl until we can decide on an approach.
> At this point, though, optional fields in Go are basically useless if one's
> application makes use of the magic "absence" value.
--
This message was sent by Atlassian JIRA
(v6.1#6144)