Hi, Yep, not all languages are created equal. But that's what I meant when I said that adding another language would be a matter of writing some templates and a generator. But, the important thing is that once a minimal generator is written, in theory, contributors would only need to write a new templates. For example, supporting Twisted in the Python generator is actually a matter of returning Deferreds in client calls, but it still required changes in the generator.
Cheers. On Friday 06 March 2009 20:28:47 Mark Slee wrote: > I'd just point out that there are more differences between the language > generators than it seems on the surface. We tried to have much more code > reuse across the language generators than we ended up with, especially for > C++/Java etc. which seem highly similar, but it turned out in practice to > get really awkward really fast, so we erred on the side of more standalone > language generators that are easier to understand in isolation. > > I still think templates with more shared code for different generators is a > good avenue to explore, but just want to raise a caution flag that it's > been tried, and is reasonably difficult. > > -----Original Message----- > From: Esteve Fernandez [mailto:[email protected]] > Sent: Friday, March 06, 2009 3:04 AM > To: [email protected] > Subject: Re: Some thoughts about changes to Thrift > > On Friday 06 March 2009 03:24:23 Mark Slee wrote: > > That's pretty much my fault. > > Actually the current Thrift compiler served its puporse quite decently, but > the coming of new languages and features has made it (along with the > generators) a bit more complex and less easy to maintain. > > > I personally like Java and think it'd be a decent choice, but there do > > seem to be a decent number of people out there building services who > > seem to vehemently hate Java. Lots of *nix systems do not have a JVM > > or JDK installed by default -- and it's pretty annoying for users who > > aren't writing services in Java to have to install it to build the > > compiler. > > I'd argue for writing a parser in Java and use a template engine (Velocity, > Freemarker, etc.). Why not Python? Dunno :-) I think Java is more widely > deployed, it has better tools for scanning and parsing and more developers. > Etch, another incubating project with similar goals to Thrift, uses JavaCC > for parsing and Velocity as template engine for its compiler and > generators, even though it also emits C# > > Using a template engine would make development of new features and the > inclusion of more languages much easier. Instead of having to hack a > generator to add some new feature, we could simply supply a new template > file. For example, at some point in the future I'd like to build a > generator for Javascript, and if we used a template engine, it would be a > matter of writing a minimal generator and a bunch of templates. > > Cheers.
