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. 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. Regards David M Bennett FACS Andl - A New Database Language - andl.org
