That's what I figured. Thanks.
On Wed, Jan 28, 2015 at 12:16 AM, Jens Geyer <[email protected]> wrote: > (2) will not be fixed, IMHO. To fix that, the deserializer needs information > about the references, which is information that goes not over the wire yet. > > Have fun, > JensG > > ________________________________ > Von: Stuart Reynolds > Gesendet: 28.01.2015 07:28 > An: [email protected] > Betreff: Re: Self referential classes > > So I guess there two kind of self referencing: > > 1) type self referencing: struct A refers to struct A somewhere in > the types of its fields. > 2) object self referencing: > > A a = new A() > a.selfRef = a > serialize(a) // infinite loop? > > > I'm guessing the "&" keyword fixes (1). Is it also a fix for (2)? (by > changing the codec to track already-seen object references) > > > On Mon, Jan 26, 2015 at 10:21 PM, Stuart Reynolds <[email protected]> > wrote: >> Got it. Thanks. >> >> On Mon, Jan 26, 2015 at 7:24 PM, Henrique Mendonça <[email protected]> >> wrote: >>> Sorry for not being clear. >>> As Jens said, it should be all good even on C++, if you use the reference >>> keyword "&" like in: >>> https://github.com/apache/thrift/blob/master/test/Recursive.thrift#L26 >>> >>> - Henrique >>> >>> On 27 January 2015 at 13:58, Stuart Reynolds <[email protected]> wrote: >>> >>>> Hi Henrique, >>>> >>>> Thanks, >>>> >>>> Just to be super-clear, in 0.9.2 and above, its OK in thrift to have: >>>> (1) structs that have fields of its own type (fine for most languages, >>>> but you'll be sorry if you C++) >>>> (2) structs that have fields that are containers of its own type (i.e. >>>> is allowed in all target languages) >>>> >>>> ? >>>> >>>> I'm working on a scala plugin extensions in the swift2thift project >>>> and want to nail down what *should* be allowed. >>>> >>>> Thanks, >>>> - Stu >>>> >>>> >>>> >>>> On Mon, Jan 26, 2015 at 2:49 PM, Henrique Mendonça <[email protected]> >>>> wrote: >>>> > Hi Stuart, >>>> > >>>> > That should work, are you having any problems? Please have a look on: >>>> > https://issues.apache.org/jira/browse/THRIFT-2421 >>>> > and: >>>> > https://issues.apache.org/jira/browse/THRIFT-2471 >>>> > >>>> > both already on 0.9.2 >>>> > >>>> > Cheers, >>>> > Henrique >>>> > >>>> > >>>> > On 27 January 2015 at 02:05, Stuart Reynolds <[email protected]> >>>> wrote: >>>> > >>>> >> Looking at the archives: >>>> >> >>>> >> >>>> http://mail-archives.apache.org/mod_mbox/thrift-user/201011.mbox/%[email protected]%3E >>>> >> >>>> >> I understand that the following causes problems for C++: >>>> >> >>>> >> struct A { >>>> >> 1: A a; >>>> >> } >>>> >> >>>> >> because sizeof(A)==infinity. >>>> >> >>>> >> >>>> >> 1-- the above .thrift compiles for in thrift 0.9.2. Are there guards >>>> >> against it in later versions of thrift? If so, can there any >>>> >> configuration possible surround this? (for example, ignoring the error >>>> >> because C++ it not a target, or changing the C++ output to use aptr >>>> >> for field members). >>>> >> >>>> >> 2 -- Are self referencing collections generally allowed? (Can't test >>>> >> locally -- for now stuck with 0.9.2) e.g. : >>>> >> >>>> >> struct A { >>>> >> 1: list<A> children; >>>> >> } >>>> >> >>>> >> >>>> >> Thanks, >>>> >> - Stuart >>>> >> >>>>
