A JVM language with a difference: Eclipse Xtend (now with Android)
Eclipses statically-typed JVM language has just received a bumper update. We talk to co-creator Sven Efftinge about the newest features.
“The idea is to free developers from the limitations of Java without tearing them into a whole new world,” co-creator Sven Efftinge told JAXenter. “It translates directly to Java source and is also otherwise designed to fit into Java projects seamlessly.”
“In fact Xtend works better with many Java libraries than Java itself does, as it is designed for Java taking existing idioms into account,” he boasts.
Efftinge is keen to point out that Xtend offers “the expressive power” of other languages like Lisp, Smalltalk, Ruby and Scala, but “without compromising interoperability and tool support,” favouring to use existing Java tools and frameworks.
Xtend’s latest release, which is out today, enters new terrain with comprehensive support for Android – adding debugging compatible with the Dalvik VM and a Maven archetype. Efftinge believes that Xtend is as much for the developers coding for the mobile platform as those developing with Java.
“[They] face the same limitations in terms of expressiveness,” says Efftinge. “Android apps written in Xtend are as fast as if they were written in Java but the written code is much more readable.” The Xtend founder says that because the language doesn’t have a heavy library with it, the footprint of resulting Android apps is “pretty small”.
Xtend’s biggest change at the language level is the inclusion of macros, through a provisional API called ‘Active Annotations’. Developers can now declare annotations, to tell the compiler how to translate Xtend elements into Java.
Efftinge describes Active Annotations as “a secret weapon” for classical programming problems.
“You can for instance declare an annotation @Observable, annotate fields with it and get observed setter methods automatically generated,” he explains, before adding that changes happen on the fly.Other new language features include collection literals, extension variables and extra support for declaring enums. You can check out the project homepage for more information, and all the latest changes can be found in the Eclipse release notes.