You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Randy Abernethy (JIRA)" <ji...@apache.org> on 2014/10/03 01:05:34 UTC

[jira] [Commented] (THRIFT-2717) C++11 generator

    [ https://issues.apache.org/jira/browse/THRIFT-2717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14157368#comment-14157368 ] 

Randy Abernethy commented on THRIFT-2717:
-----------------------------------------

I think this is awesome. Many of us would love thrift --gen cpp11 and I think the ground swell would produce a community driven Cpp11 lib pretty quick.

I would like to suggest the following:
1. The compiler stay C++98 (that is to say, generate the Cpp11 code with a Cpp98 compiler). The compiler really needs to build on Precise and Centos 6.5 (and others) for a while longer. In my mind, if we still need the Cpp98 library than we probably need a compiler that builds with Cpp98. Lots of folks don't care about Cpp (of any flavor) but want to be able to build the compiler on their target.

2. Make the thrift --gen Cpp11 code Boost free. The thrift dependency graph is startling already due to the vast language support and Boost is a big thing in that graph. Using Cpp11 we can get rid of the Boost runtime lib dependency, boost::shared_ptr and all the rest. Apache Thrift should be a utility, it should be an appliance, it should work like your refrigerator, just plug it in and forget it. Boost is awesome and lots of people use it in their apps, but we shouldn't force them to use it. If you don't know anything about Boost, it could eat a lot of your time learning and configuring. Before Boost was a necessity, now the Boost feeder platform has integrated most of its critical innovations into Cpp11/14. More to come for sure but from a core feature standpoint Boost is becoming more of a leading edge test bed and vertical markets solution environment. The Cpp standards guys finally figured out that 13 years is too long for a real update and great new Boost things are showing up pretty quick. 

In my view, many, if not most, of the people who use Thrift don't care about Thrift. They are just trying to get their cool Hive feature working, snagging some data from from Cassandra or trying to replace their slow REST interfaces. I would like it if Thrift was always a help, never something slowing folks down. Thrift is the most powerful when it is invisible. I think Cpp11 is a huge opportunity to simplify and really improve adoption, which in the end helps us all. 

> C++11 generator
> ---------------
>
>                 Key: THRIFT-2717
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2717
>             Project: Thrift
>          Issue Type: New Feature
>          Components: C++ - Compiler
>            Reporter: Konrad Grochowski
>
> instead of adding another set of options to 'old' cpp generator I've started creating new one in:
> https://github.com/hcorg/thrift/tree/cpp11_generator
> using old as an reference
> main goals:
>  * code compatible with old librart (at least for first tests, new lib and compiler switches can be added later)
>  * no more ugly {{__isset}} structure -> boost::optional for optional values
>  * as a result - no more {{__}} in names, which violates C++ standard
>  * all generation code will have own unit tests (TDD used wherever possible)
>  * generated types headers independent from Thrift header, to allow other layers of application using generated types without dependency leaks
>  * each type will generate own header/cpp file - easier for user to include only used parts.
>  * unordered map/sets
>  * returning using move semantics, no more ugly 'return via output parameter' (still possible as option thou - sometimes it's needed for performance)
>  * async client using boost::future
>  * enum classes
>  * initializer lists for constants (maybe)
> I'm aiming in C++11 subset available in gcc 4.8 and MSVC 2013
> currently I have only complete enum generation, but work is in progress
> all comments etc are very welcome :)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)