The Eclipse Foundation has quietly launched a new language, Xtend, which it says is designed to address shortcomings of Java without replacing it.
The aim of Xtend is to create more readable code, to add features that Java needs but doesn’t have, and to offer “a convenient alternative in situations where Java doesn’t shine”.
Xtend ships as a set of plugins to an Eclipse install already running Java Development Tools (JDT). The developers say it “complies to readable Java code”, with support for familiar Eclipse Java IDE features like syntax coloring, content assistance, rename factoring and so on.
It maintains Java’s static typing, but creates “type inference” to reduce the amount of redundancy in Java code, with the foundation stating that “a lot of the information written down in a Java file is actually technically redundant”.
It supports direct access to Java properties, allowing a more “natural” statement like person.name=”Foo” to replace person.setName(“Foo”).
Features that Xtend adds to Java programming include closures, a more “elegant” Switch expression, Template expressions and Extension methods. ®
Eclipse describes Xtend’s library “a thin layer over the JDK” that “interacts with Java exactly the same way as it interacts with Xtend code.” Xtend code is also callable from Java. ®