|Eclipse Xtend Reaches 2.4|
|Written by Alex Armstrong|
|Friday, 22 March 2013|
If you haven't heard of Xtend don't feel too bad as it isn't making news headlines like Go or Dart, but it might be important and the latest version has some interesting new features.
Xtend 2.4 has some interesting new features, but really it is the ideas that drive the Xtend project that are really interesting. It is a Java-like language but, according to the publicity, not intended to replace Java but to improve it.
At first look Xtend seems to be Java with some extra bits. It compiles to Java code. Yes you heard that correctly - it produces human readable Java, not machine executable byte code. This is supposed to mean that you can use your Java knowledge to go in and edit the compiled source code. It has been implemented using the Xtext system, a tool to enable the easy creation of Domain Specific Languages. In this light, Xtend is a really impressive demonstration of how powerful Xtext is.
If you would like to see it in action watch the following video which is about an earlier version:
Xtend introduces lots of new features to Java that make it easier to write code. For example, it uses type inference to make it possible to write strongly typed code but without you have to declare the type of every variable. In version 2.4 the entire type system has been re-implemented to be faster and more consistent. The type inference engine is also claimed to be smarter and capable of infering type where languages such as Scala fail.
The second big new feature is the ability to use Lisp-like macros as active annotations. You can add an annotation to indicate how elements should be translated to Java. If the term "Lisp-like" is putting you off the idea, then you need to see it in action. As the documentation says, "this is code generation like it should be".
There are also lots of smaller improvements, including a more polished IDE with formating, refactoring and generally more help.
The new system can be used with desktop Java or it can be used with Android as this too is dependent on the JDK. The standard development environment for Android is also Eclipse, so the two fit together quite well. The new version of Xtend has support for debugging Android using the emulator and other new integration.
If you want a better Java. but still need to work with Java. then Xtend might be worth looking at. If you need to create a DSL, then certainly Xtext should be on your list of possible approaches. If it can build Xtend then it can be used for just about anything.
To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin, or sign up for our weekly newsletter.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Friday, 22 March 2013 )|