thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Bennett" <>
Subject RE: Major feature suggestion/observation
Date Wed, 07 Oct 2015 00:11:21 GMT

David M Bennett FACS

Andl - A New Database Language -

-----Original Message-----
From: Roger Meier [] 
Sent: Wednesday, 7 October 2015 5:34 AM
Subject: Re: Major feature suggestion/observation

Hi David

Quoting David Bennett <>:

> I'm a compiler guy (amongst other scars). I was somewhat surprised 
> when I opened up the Thrift compiler to discover that it uses 
> industrial strength parsing (for a very slim language) and a 
> hand-rolled, ad hoc source code generator (for a serious backend 
> problem). I had expected the exact opposite.
> After reading a few comments on this list I think a number of the 
> shortcomings of Thrift result from this. The compiler may be 
> 'tweakable' but it sure ain't configurable. The precise content of the 
> generated code (and how to alter it) is an ever present problem.
> My suggestion is that the backend of the compiler should be entirely 
> rewritten using modern code generation technology and a selection of 
> 'skeletons' provided as separate text files. Anyone who wanted to 
> tweak the output for any of their special use cases could easily copy 
> and modify an individual skeleton without having to venture into the 
> dark recesses of the C++ compiler.

>>>Did you had a look at the JIRA issues related to rewrite and changes on the compiler?

I found this one: It's right on the money,
but seems to have been silently abandoned 4 years ago. Looks like the guy who tackled it didn't
know enough about template tools to make it happen, despite the best of intentions.

I didn't find anything else remotely similar, but lots of requests for little tweaks that
would become no-brainers with a template system.

>>>Have you seen the python variant? This was another try to do it again.

No. Which issue?

>>>I have seldom seen some successful rewrites, usually it takes too long to bring
them to the same level. Personally, I'm a fan of evolution.

Agree absolutely. The only way to tackle this kind of transformation is to treat the existing
compiler as the spec and set out to replicate it, to the point of being able to pass identical
regression tests. That works, but it takes a while just to get back where you started.

> With luck, the initial batch of skeletons could be extracted directly 
> from the existing compiler. It's still a biggish job.
> [Side digression: for some languages code generation is not really 
> needed. The language has sufficient abstraction capability to 
> implement the IDL directly. Since there are other languages that do 
> not, we are stuck with code generation.]
> The biggest choice is: which product to use for the code generation?  
> I have a little familiarity with T4 and the ANTLR StringTemplate, and 
> I've hand-rolled a couple of my own but there are heaps of others out 
> there. Maybe it all comes down to what you're used to.
> I'm not sure I'm quite ready for the investment of time.

>>>Feel free to rewrite the compiler and provide a test suite for review.

Probably not -- Andl is keeping me busy enough for now. I was kind of hoping someone with
C++/compiler experience could at least nominate a suitable template product. I don't know
one, and a quick look at cpptemplate does not leave me filled with joy. Without this, it's
just far too much work.

>>>Improving the test suites across languages, improving CMake, fixing bugs and many
other topics to improve on Thrift has much higher priority than rewriting something we already

I get that. What Thrift does and what it needs don't really overlap my skill set (or my interests)
all that well, but I will keep an eye out for somewhere I can help.


>>>PS: dev list is a better place for such discussions.

Thanks. I'll look into that.

> Regards
> David M Bennett FACS

View raw message