GitHub user djwatson opened a pull request:

    https://github.com/apache/thrift/pull/84

    Tree/Recursive struct support in thrift

    Patches to implement tree/list/co-recursive structures in thrift, a la 
protobufs.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/djwatson/thrift trunk

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/84.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #84
    
----
commit b6134cedf292845e5ed01052919894df6b561bf2
Author: Dave Watson <davejwat...@fb.com>
Date:   2014-03-20T18:12:04Z

    Recursive structs support in parser
    
    A common complaint is that you can't express trees or other recursive 
structures in thrift easily - unlike protobufs. This diff loosens up the parser 
to allow using structs before they are defined (and uses typedef as a forward 
declaration).
    This diff is actually enough to make recursive types work for some dyamic 
languages (I tried php, works out of the box!)
    
    Other languages will need forward declarations, or ways to box types, to 
make this work (i.e. C++ needs both forward decls and a way to express structs 
as pointers)

commit 477b5fcf31ac71ff8420f96dc16ccf0cf6b35ac5
Author: Dave Watson <davejwat...@fb.com>
Date:   2014-03-21T17:17:39Z

    C++ support for recursive structs.
    
    For cpp added a cpp.ref annotation.  Users will have to make some recursive 
types use references to avoid a struct containing itself.  Also had to 
explicitly check for null references when reading/writing, so we know to set 
the reference to null.
    
    Merge from fb's branch of 
https://github.com/facebook/fbthrift/commit/9b36d51579bca5ca1c77be333693aa104e8ed141
    
    Fb uses C++11 extensively, this merge changes the type to a raw pointer and 
adds deletes where necessary.  This is *very* similar to how protobufs does it.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to