While not as elegant or efficient as having native type support for trees, or recursive data structures in general, these can be built in a slightly less efficient manner using the existing IDL (and I imagine we've all used work arounds like this at this point).

For example, if you know your tree won't have more than 2^16 nodes, and you just want to store strings:

struct Tree {
 10: map<i16, string> values,
 20: i16 root,
 30: map<i16, list<i16>> children
}

Then it's a pretty simple matter to convert this to/from an appropriate data structure in your language of choice.

This makes me think that we should have a community repository where we can keep track of all the little thrift snippets for various languages that are floating around. We could probably also use this to build experimental patches (like streaming, support for references, etc.) that might not be ready for the apache repo.

I know there are projects and repos floating around with experimental options, so maybe the first step is listing all these on the wiki?

-Ben

Reply via email to