What’s New in Scala IDE for Eclipse 2.0 Branch?
The new compiler interface reflects what we learned about how Eclipse works.
Iulian Dragos has been working on Scala since 2004, when he joined Martin Odersky’s research lab at EPFL. He wrote the JVM backend, the bytecode optimizer. He also implemented type-directed specialization for Scala 2.8, and maintained various other parts of the compiler. He earned his PhD degree at EPFL in 2010. Currently he works for Scala Solutions, a start-up founded by the language creator, Martin Odersky, where he works on development tools for Scala (mainly the Eclipse plugin for Scala).
The first beta of the Scala IDE for Eclipse 2.0.0 marks a big change for the project, being described as a “large departure from the initial code base” at the release announcement. Not only does it feature a completely revamped compiler interface but, in focusing on reliability and stability, not all the features from the 1.x series have been ported to the new compiler interface. In this interview, JAXenter caught up with Scala Solutions’ Iulian Dragos, to find out more about the first release of Scala IDE for Eclipse 2.0.0.
JAXenter: What influenced the decision to completely revamp the compiler interface for the Scala IDE for Eclipse 2.0.0 beta1?
Iulian Dragos: The main reason was that the Scala IDE for Eclipse had issues in terms of reliability and responsiveness that were caused by deep-rooted architectural mismatches. There were mistakes on both parts: the compiler didn’t provide exactly the right information to the plugin, and the plugin was using the compiler in ways it wasn’t designed for. The new compiler interface reflects what we learned about how Eclipse works, and it required a concentrated effort on both the compiler side, and the IDE side. The compiler side was written by Martin Odersky, the creator of Scala, and the IDE side was mainly on Eugene Vigdorchik’s shoulders- former IntelliJ Idea developer, now with Scala Solutions.
JAXenter: What are the benefits of overhauling the user interface in this way?
Iulian: The user interface is unchanged. What is different is what happens under the hood. Roughly speaking, there’s an asynchronous Scala compiler waiting for the UI to ask for information, such as the structure of a file, the members of a type (content assist), or the position where a certain symbol is defined (hyperlinking). Requests are placed on a work queue, and the compiler can be interrupted any time (for instance when the user starts typing it makes no sense to continue type checking, since the program has changed).
The obvious benefits are very good responsiveness, and very accurate information. We can now use the IDE when developing the Scala compiler itself (almost 100k lines of code). It remains responsive, even on files over several thousand lines of code. There’s never a lag when typing, which is something that was very annoying before. The accurate information comes from the fact that the IDE uses the Scala compiler, so you are sure to get the same behavior as when using the command line compiler.
JAXenter: Existing features in the 1.x series were reviewed and some ported to the new beta release. What features did not make it into 2.0.0 beta1? And, moving forward, what are the plans for these features?
Iulian: The two branches are quite different. 2.0 is the branch that takes advantage of the new compiler interface, and has all the reliability and responsiveness improvements. 1.0 is the old code base, on which people from the community (led by David Bernard) have backported many of the fixes in the 2.0 branch. At the same time, it kept all the experimental features, and it works with Scala 2.8.x. The latest beta version requires Scala 2.9, which is in the release candidate phase, so I expect it to be out in about a month. So if you have to stay with Scala 2.8.1, your best bet is 1.x, but you won’t get all the improvements.
Speaking of features, the only one that’s missing at this point is ‘highlight implicits’, which is the result of last year’s Google Summer of Code. We chose to concentrate on getting the basics right, and this code hasn’t been reviewed yet. It could be problematic because it needs full type checking, which is time consuming. We need to make sure it won’t affect responsiveness. As for the near future, we plan to merge the two versions.
JAXenter: Currently, the Scala IDE for Eclipse team are actively maintaining two versions of the plugin. How do you imagine this will develop, in the future?
Iulian: As mentioned earlier, we plan to merge the two branches soon. We don’t like to duplicate work. I should mention that the community has been very helpful, and contributed patches to both branches – like the excellent formatter and syntax highlighter configuration by Matt Russell.