4 ms·
This is exactly the field that I'm working on, so I'm quite interrested by this. In my opinion, the problem is more of a tools problem than a language problem
by Raphael_Amiard 13y ago
This is exactly the field that I'm working on, so I'm quite interrested by this.
In my opinion, the problem is more of a tools problem than a language problem : One language that has one of the most interresting support for this kind of things is C, with coccinelle [1] [2].
Google has been working on absolutely amazing tools for C++ that applies programmatic refactorings in a distributed manner on absolutely enormous codebases [3].
This IMHO shows that this is a tools issue rather than a language issue. Coccinelle had to develop a swat of parsers for its project, and the Google project is using Clang as a basis for structural and semantic capabilities. C and C++, with their fragile type systems, preprocessor, horribly hard to parse syntax, might be the worse languages amongst typed languages to develop such projects on. And in spite of that, they are the ones for which such project exist, because they are the one with enough need for such tools.
Of course some languages are more amenable to such tools than others. Very strong static typing and a solid package system helps a lot. No metaprogramming helps too (because you don't have to handle the transformation).
I'm working on such tools for Ada, that is pretty much the perfect language for this as far as imperative languages go. The essential need for such tools is to have a compiler that exposes some services as an API, most notably the ability to explore the AST and query cross references for language entities. This was the fantastic insight of Clang/LLVM in my opinion.
[1] Coccinelle semantic patch language : http://lwn.net/Articles/315686/ http://lwn.net/Articles/315686/
[2] Presentation on refactoring with coccinelle
http://video.rmll.info/videos/coccinelle-automated-refactoring-and-more/ http://video.rmll.info/videos/coccinelle-automated-refactori...
[3] Clang MapReduce -- Automatic C++ Refactoring at Google Scale http://www.youtube.com/watch?v=mVbDzTM21BQ http://www.youtube.com/watch?v=mVbDzTM21BQ
- charlieflowers 13y agoInteresting! I knew about clang and what Google is doing there. It is definitely related to the point I'm trying to convey. I'll be taking a close look at Coccinelle. Thanks for the link. And as you say, C and C++ "might be the worse languages amongst typed languages to develop such projects on," due to things like the preprocessor, hard to parse syntax, etc. So I'm saying, perhaps it is time to invent the programming language that is most amenable to this. It's amazing what we can do if we put our best engineers onto the hard problem of achieving this with C / C++ code. Imagine what might be possible if we designed a language from scratch with the primary goal of making this easy. As far as I know, no programming language has ever been designed with this as its primary goal (I'd love to be corrected if I'm wrong).
- pjmlp 13y agoI think it was either Grace Hopper or Barbara Liskov, that once made a statement that C entry into the mainstream computing has set the compiler development back to stone age.