You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by Jens Geyer <je...@hotmail.com> on 2014/04/16 20:24:25 UTC

cpp.ref annotation - not only for cpp

Hi all,

my proposal would be to make the new cpp.ref annotation more global. The same thing is needed at least in one other language, and there may be more (disclaimer: I have not checked, how many or if any at all). I think it is better to use one annotation instead of multiple <language>.ref annotations.

What do you think?

Have fun,
JensG

Re: cpp.ref annotation - not only for cpp

Posted by Ben Craig <be...@apache.org>.
I talked with Jens some in IRC about this.  I was getting my features 
mixed up.  cpp.ref is currently used for supporting trees / recursive 
structures.  I think it makes sense to make that feature language 
agnostic.  The languages that only support reference semantics can ignore 
it, but cpp, go, and any other language with value semantics can use it 
for optimizations / proper functioning.

I was getting confused with some other annotation (cpp_type?) that lets 
you customize code generated types, like switching std::map with 
std::unordered_map.

Ben Craig <be...@apache.org> wrote on 04/16/2014 01:45:30 PM:

> From: Ben Craig <be...@apache.org>
> To: dev@thrift.apache.org, 
> Date: 04/16/2014 01:46 PM
> Subject: Re: cpp.ref annotation - not only for cpp
> 
> Seems like we need to allow multiple .ref annotations for a single 
field. 
> You may want an unordered_map with cpp, but a custom dictionary class in 

> Java.
> 
> So this feels like it should be treated similarly to namespaces, where 
you 
> can use one namespace for all the languages, but you can also have a 
> different namespace per language.
> 
> "Jens Geyer" <je...@hotmail.com> wrote on 04/16/2014 01:24:25 PM:
> 
> > From: "Jens Geyer" <je...@hotmail.com>
> > To: <de...@thrift.apache.org>, 
> > Date: 04/16/2014 01:24 PM
> > Subject: cpp.ref annotation - not only for cpp
> > 
> > Hi all,
> > 
> > my proposal would be to make the new cpp.ref annotation more global.
> > The same thing is needed at least in one other language, and there 
> > may be more (disclaimer: I have not checked, how many or if any at 
> > all). I think it is better to use one annotation instead of multiple
> > <language>.ref annotations.
> > 
> > What do you think?
> > 
> > Have fun,
> > JensG

Re: cpp.ref annotation - not only for cpp

Posted by Ben Craig <be...@apache.org>.
Seems like we need to allow multiple .ref annotations for a single field. 
You may want an unordered_map with cpp, but a custom dictionary class in 
Java.

So this feels like it should be treated similarly to namespaces, where you 
can use one namespace for all the languages, but you can also have a 
different namespace per language.

"Jens Geyer" <je...@hotmail.com> wrote on 04/16/2014 01:24:25 PM:

> From: "Jens Geyer" <je...@hotmail.com>
> To: <de...@thrift.apache.org>, 
> Date: 04/16/2014 01:24 PM
> Subject: cpp.ref annotation - not only for cpp
> 
> Hi all,
> 
> my proposal would be to make the new cpp.ref annotation more global.
> The same thing is needed at least in one other language, and there 
> may be more (disclaimer: I have not checked, how many or if any at 
> all). I think it is better to use one annotation instead of multiple
> <language>.ref annotations.
> 
> What do you think?
> 
> Have fun,
> JensG