Scala, a language specializing in functional and object-oriented programming, has been running on the Java virtual machine for several years now, enjoying adoption
from enterprises and startups alike. The language's road map features three upcoming upgrades -- version 2.12, "Aida," and "Don Giovanni" -- with the last release to serve as a "fundamental rethink" involving modularity, says Scala designer Martin Odersky, who is chairman and co-founder of Typesafe, which offers middleware based on Scala. He also serves as a computer science professor at Ecole Polytechnique Federale de Lausanne (EPFL) in Switzerland.
InfoWorld Editor-at-Large Paul Krill recently talked with Odersky about what's ahead for Scala.
InfoWorld: Can you talk about the road map for Scala? I see there are three versions planned: Scala 2.12, Aida, and Don Giovanni
Odersky: So 2.12, that's the first one. The main goal of 2.12 to have a good integration into Java 8. We want to make use of all the new features in Java 8, in particular lambdas and default methods and traits. We don't publish release dates, but the current schedule is about 18 months per release.[Editor's note: Scala 2.11, the latest version, was released in April.]
InfoWorld: A lot of Java 8 is about functional programming and lambdas. Scala has already had that. How can you be compatible with Java 8 but not redundant with it?
Odersky: That's a question that's been debated a lot. I think it's actually the opposite. The industry as a whole is moving to functional languages, and Java 8 is one of a much broader movement. You could actually argue that the movement to functional languages is very, very strong now and what Java 8 provides will be -- for people who do functional programming -- is [to] whet their appetites for more, and Scala provides the more. Java 8 is actually a very good bridge toward a richer functional programming environment, and Scala can provide that. Java 8 does not make Scala redundant, but at the same time, it is very important to be interoperable with Java 8.
Secondly, of course, since Java 8 contains important virtual machine improvements, [we want] to make the best possible use of them. [Compilation of Scala programs] can be much more streamlined with the new Java 8 runtime, VM runtime. In particular, we need to generate way fewer classes. That means we can have libraries and runtimes that are much more compact than the ones we had to ship until now.
InfoWorld: Basically, there's functional programming and lambdas in Java 8, but Scala gives you more of that than what you're going to get in Java 8?
Odersky: Yes. Lambdas are just the start. Functional programming, it's a big thing where you need many, many more things, and it makes many, many more things simpler. For instance, functional programming starts with the fact that you say everything you write is an expression, and Java 8 doesn't have that. It has statements and expressions, and most things are statements and not expressions, so they don't return a value.
InfoWorld: So Scala has a complete basis for functional programming?
Odersky: Yes, indeed it has.
InfoWorld: What about the next release, Aida? Could you talk about that release and what's in it? It is set to focus on improving the standard library.
Odersky: Aida will be about the next step for Scala libraries. The Scala libraries essentially still have a very powerful set of collections for functional programming. While powerful, there are also some things that are needlessly complicated in these collections and are maybe traps and pitfalls. We want to clean that up. Also, we also want to integrate the Java 8 parallel collections [streams] into that framework seamlessly.
InfoWorld: When will Aida be available?
Odersky: It's probably too far out to say for sure. What we aim to have is a preview, a developer prototype, about the time 2.12 is out.
InfoWorld: What about the Don Giovanni release?
Odersky: That's going to be a more fundamental rethink of what Scala is. The main goal is to make it simpler, to review it or work out what its core is, and have a very simple core on which essentially the other features of Scala can all be based. Essentially, it's a way to modularize the language better, to base the features that we know from Scala on a very, very simple core that we can compile efficiently and reason precisely about. That's the main goals for Don Giovanni.
[Also], we want to eliminate some traps that people have found hard in Scala -- so-called puzzlers. We want to improve the tools. We want to have a super type system. We want to have a cleaned-up syntax, and we want to have some things more powerful [and] make things more regular and neater. [It is not so much about] adding new functionality to the language. I think Scala has enough functionality. That's not the problem. What we want to do is make it really into a very, very clean package for the programmer.
InfoWorld: So you think Scala needs this kind of fundamental rethinking?
Odersky: It could profit from that. Scala is a bit of a one-of-a-kind language in that it is really the language that goes furthest in providing this fusion between object-oriented and functional programming. I think that's, in the end, where the industry is moving. If you look at recent languages like Swift from Apple or the next iterations of C# from Microsoft, they all go in this direction. Essentially, the fusion of [functional and object-oriented programming] can have a power that neither of the two paradigms individually can have.
InfoWorld: In 2011, Yammer moved away from Scala and over to Java. The company cited the complexity of Scala. Has that problem been addressed since then or are you looking to address that problem with the upcoming upgrades?
Odersky: Actually, I think Yammer mostly cited unpredictability of runtime performance, but they said they were writing very, very low-level code, so essentially very down-to-the-metal code. The performance bottlenecks they cited have been been addressed in the meantime -- the collections shortcomings. In terms of complexity, I don't know whether Yammer featured that, but you definitely do hear that a lot [from] many people. Yes, absolutely -- that's precisely what we want to address in the future versions.
InfoWorld: You mentioned Swift. What's your take or perspective on Swift, which Apple just introduced, and on another language that's becoming popular, Node.js?
Odersky: You could say that Swift related to Objective-C is a little bit like Scala related to Java. It runs on the Apple platform, but it's a higher level, a more functionally inspired language than the standard language. In fact, if you look at it, it borrows a lot of features from Scala. In a sense, it's a validation of what Scala does. To see that reflected in Swift shows that we must have done something right here.
InfoWorld: You said a couple years ago that there were a lack of tools for use with Scala. Has this been remedied?
Odersky: Yes. Both the Eclipse Scala IDE and the IntelliJ Scala plug-in work are now mature and work generally very well. There is now also a very good Scala-specific debugger. Also, lots of third-party tools for code coverage, style-checking, bug-finding exist. Some of them commercial, (for example), the one by Semmle.
InfoWorld: Is there anything else you want to mention about Scala?
Odersky: We are in the middle of a paradigm shift [in] the industry, and there will be a new equilibrium between functional and object-driven programming, and Scala is leading that.