Monday, July 25, 2011

JVM Language Summit 2011

Back from Santa Clara, CA where I've attended an awesome event - JVM Language Summit. Before the event I thought I know some Java, but it seems I was too self-confident :) The 3 days of technical sessions revealed to me a lot of new things in Java world, including the new features coming in the next versions of Java as well as some JVM-based languages that I didn't pay attention to previously.

Day 1

The event started with a short intro by Brian Goetz followed by a keynote speech by Cameron Purdy. Cameron presented an awesome wishlist for the upcoming versions of Java/JVM. Some of the features I liked the most on that list:

Immutability. The main concern was pretty much about how could Java get so far without immutability natively supported by the language?

Obvious Intrinsic Types are just missing from Java. And this is the major pain for the developers dealing with financial calculations whereas the rule of thumb is - never use double for operations on monetary values. Indeed, every Java programmer should see this presentation - How Java's Floating-Point Hurts Everyone Everywhere. The good news is, IEEE 754-2008 a.k.a. IEEE 754r – defines decimal types, the bad news, it is not yet implemented.

Alternative class format is something that tool implementers would definitely love - why inner classes aren't inner classes? why anonymous classes are not properties of a method where they are defined?. In fact, I was carrying the idea around with myself on why not to try to implement the class nesting into the VM? I was actually thinking it is a crazy idea of mine but it turns out other people do have same crazy ideas! :)

Tail Recursion / Tail Call Optimization is something that every developer, who tried some FP language, misses from Java. I've tried Erlang a while ago, and after a few weeks I really could live without this feature.

Cameron had plenty of other stuff on the list but I'd rather skip mentioning all the points. The presentation slides are available here.

Async .NET

It was quite an interesting presentation by Mads Torgersen. It is nice to know, what are the people working on the other major managed runtime come up with in a while. The main feature that Mads was talking about was the asynchronous task execution coming in C# 5. Basically it is similar to what Java has with Futures. The presentation slides are available here, and actually I've found a video on the same subject at Channel 9 - recommended!.

Indy FTW!

Now it was all about invokedynamic, method handles, call sites, etc. First, John Rose talked about Method Handles. And after that, Dan Heidinga talked about the method handles implementation in IBM J9.

These followed by the language implementers - demonstrating how invokedynamic and method handles can be used: Charles Nutter on JRuby, and Remi Forax on JSR-292 Cookbook. JRuby folks take a great advantage of the invokedynamic which allows a lot of optimizations hence improving the performance. Remi Forax presented a number of Method Handle usage tips. The collection can be found at One really cool thing I've got to know is the ClassValue which can serve as a metadata carrier that might be required for dynamic method invocation.

Day 2

The first half of day 2 was mostly related to all the same JSR-292 features: porting Smalltalk to JVM, new implementation of JavaScript on JVM, Jython&Indy.

Dynalink, presented by Attila Szegedi, is an interesting project for dynamic linking in Java - as far as I understand Dynalink could be used to implement invokedynamic behavior on JVM.

After all the dynamic fluff-and-stuff the statically typed languages came on stage.

Gosu. Honestly, I underestimated the language when I learned about it the first time. This time I was actually surprised by the features presented in Gosu, accompanied with compiler support and the open type system. A couple of years ago I used Drools and Groovy to implement the rules-based system. If I knew about Gosu at that time it would probably be my language of choice. Especially neat is that one can basically connect some XML or properties file to the type system and tell that this is a new type in Gosu, and get all the type-checking backed by the compiler. Just awesome!
Gosu doesn't seem to tackle any of the general-purpose language but it definitely has its niche - a statically-typed language for writing business rules.

Project Kotlin, presented by JetBrains developers, Andrey Breslav and Dmitry Jemerov, has definitely created a lot of buzz by now. According to the creators, Kotlin is designed to be nicier than Java, and simpler than Scala. Here're the slides from the presentation & the workshop. At first sight, the language is definitely nice to read and the syntax seems to be more friendly than in Scala, but going deeper into more advanced features, the claim tends to diminish. I noticed a lot of similarities with Scala, Groovy and C#, whereas C# features (i.e. non-virtual methods) do not seem as coherent with the other two languages. I do not have any strong opinion on the project yet - need to study it a bit and compare to other languages (read Scala) but one thing I quite sure about is that the IDE support should be top class. There are a lot of opinions currently, whether JetBrains should rather have contributed to Scala tooling, or Ceylon project.. don't know what is best - time will show. I do understand the scepsis of Scala fanboys regarding Kotlin, but it is quite stupid to underestimate this effort. IMHO, nothing replaces Java any time soon - it rather benefits of all the language experiments.

Day 3

On the day 3 there have been a few talks related to Java language itself.

Interface injection by Tobias Ivarsson, Extension Methods & Lambda Bytecode by Brian Goetz - awesome content and ideas presented. IMO, properly combined autoboxing, interface injection and extesion methods with lambdas could enable ruby-like syntax in Java, e.g. 5.times({ int x -> println(x); }. Neat, huh?

A very interesting project Graal, presented by Thomas Wuerthinger (one of the core developers on DCEVM. Graal includes a mechanism to execute the compiler outside of the HotSpot JVM which leads to "distributed compilation".

At the end Prashant Deva talked about the Chronon debugger. In fact, it turns out that Chronon isn't really a debugger but you can rather record the dataflow of your program execution and do "post-debugging" using the data recorded at runtime. It really looks as if you're debugging in the IDE, stepping through the lines of code and observing the values of variables. But technically, the plugin doesn't even connect via JVMTI - it rather emulates the program under inspection - executing queries to the recorded data set and jumping to the correct line of code in the IDE.


I think this was the most advanced and interesting Java-related event I've attended so far. I really feel myself being so dumb now - very motivating to finally take a look at some textbook on the compiler construction :)

No comments:

Disqus for Code Impossible