We are just starting to design a Thrift interface. I read about "thrift union" workaround and then subsequent addition of real union support in the trunk:
http://blog.rapleaf.com/dev/2009/06/03/thrift-union-pattern/ http://blog.rapleaf.com/dev/2009/08/18/thrift-unions-part-ii-or-how-i-reduced-memory-usage-by-95/ I'm wondering what the status of this is, because I don't see it mentioned in the tutorial or thrift language specification. Is it in the trunk? Do people use this, does it work well for you? I'm also interested in understanding the workaround (without real union support). How "bad" is the workaround in terms of memory usage? Thrift has "sparse structs" so I imagine you never had to pay the cost of the full compound structure and all substructures. Instead does the real union support basically just save you the cost of the null for each "empty" struct? Is the "struct_type" discriminating field strictly needed, can you just query for which component struct is non-empty? I guess having the type field is just faster? Thanks. -Philip
