Mark Slee <[email protected]> writes: > > I'll provide the historical backstory here in case folks are > interested. C++ was actually chosen *because* of the early commitment > to open source. C++ was by far the best available option for ease of > distribution and installation. Using Python would have required > everyone to have the right Python extensions, like PLY, which are not > part of the core language.
Well, Python does have a parser built in. That parses Python. Granted, if you give programmers enough rope they will hang themselves, but there are examples of (for instance) build systems at (ahem) certain companies that use Python to define data structures that can later, effectively be parsed using a parser that (at that time) had been 15 years in the making. what I am getting at is that I think I would probably have tried to come up with a way to describe structs, enums, services etc in terms of Python data structures and avoid having to write a new parser at all. (I guess DSLs are probably a slightly more recent fad among the conference-going-book-writing hipster crowd :-) > By contrast, lex/yacc are *completely* standard. You'll be > hard-pressed to find a *NIX distro anywhere on Earth that doesn't have > working versions out of the box, they've been around forever and their > interfaces are super stable. Like the autotools, even if they're not > the prettiest things to work with, everyone has them lying around, and > they almost always just work. well, almost. which is why you usually end up on the FAQ page when trying to build on Mac. or on a system that has a different idea of "recent". > If our goal is ease-of-installation-and-use > (optimizing for the Thrift user), then my vote is to work on removing > boost as a dependency to build the compiler. If the goal is elegance > and maintainability of the compiler code (optimizing for the Thrift > developer, which theoretically benefits the user indirectly), then I > agree that something like Java is probably better. > > Anyways, that's the story on why the Thrift compiler was written in > C++. I can understand where you are coming from. I spent about 15 years primarily hacking C/C++ on UNIX before switching to Java as my primary language around 2003 or so. Before 2002 I would probably have written a tool like the thrift compiler in C -- and as far as possible try not to depend on anything but an ANSI C compiler. in a moment of weakness I might have done it in Perl (which would have been truly awful). 6 months ago I would probably have (ab)used Python to define a DSL and avoid having to write an actual parser. perspectives change over time. -Bjørn
