Monday, April 18, 2011

Eclipse Xtend - beta available

I proudly announce that a beta release of the upcoming Xtend language is available for download now. Xtend is a modern statically-typed programming language which tightly integrates with and runs on the Java Virtual Machine. It has its roots in the Java programming language but improves on a couple of concepts:
  • Advanced Type Inference - You rarely need to write down type signatures
  • Full support for Java Generics - Including all conformance and conversion rules
  • Closures - concise syntax for anonymous function literals
  • Injected extension methods - Enhance closed types with new functionality injected via JSR-330
  • Multiple dispatch aka polymorphic method invocation
  • Operator overloading - make your libraries even more expressive
  • Powerful switch expression - type based switching with implicit casts
  • No statements - Everything is an expression
  • Template syntax with intelligent whitespace handling
  • Translates to Java not bytecode - understand what's going on and use your code for platforms such as Android or GWT
It is not aiming at replacing Java but meant to be a better fit for implementing dependency-injected components and is especially well suited for doing code generation. Its library is just a thin layer over the Java Development Kit (JDK) and it interacts with Java exactly the same as it interacts with Xtend code. Also Java can call Xtend functions in a completely transparent way. And as it is implemented with Xtext, a modern Eclipse-based IDE closely integrated with the Java Development Tools (JDT) is available.
Xtend and Java vis-a-vis


There are prepackaged Eclipse distributions available for download. They are shipped with the latest stable build and the nightly update sites are registered. So make sure you do "Help -> Check For Updates" on a regular basis to get the latest improvements.

Here are the download links :

[   ]eclipse-SDK-3.7M6-Xtext-2-nightly-HEAD-linux-gtk-x86_64.tar.gz

[   ]eclipse-SDK-3.7M6-Xtext-2-nightly-HEAD-linux-gtk.tar.gz
[   ]eclipse-SDK-3.7M6-Xtext-2-nightly-HEAD-macosx-cocoa-x86_64.tar.gz

[   ]eclipse-SDK-3.7M6-Xtext-2-nightly-HEAD-macosx-cocoa.tar.gz
[   ]
[   ]

Getting Started

Xtend is shipped with a reference documentation which can be accessed through Eclipse's Help system.
Use the menu action [Help -> Help Contents] and you will find it.

Next up you might want to start playing around. The easiest thing to do is to materialize the Xtend tutorial project, which explains all the concepts by example. To do so use the project wizard and choose [File -> New... -> Example ...] and choose [Xtext Examples / Xtend tutorial].

Getting Feedback

It is important for us to get as much feedback as possible. Please use the Xtext Forum / Newsgroup to ask questions and to file bugzillas (product : TMF / component : Xtext).

The official release will be June 22nd. The language and its library is mostly finished and will only slightly be changed until then.


The language has been designed and implemented based on Xtext 2.0 and more important together with my friends and colleagues Sebastian and Jan (Unfortunately Moritz was busy with Xtext's serializer :-)).  Our work is funded by itemis and the Federal Ministry of Education and Research.


  1. Cngratulations Sven, Jan & Sebastian! I think this working with Xtext Xbase is going to be a major step toward providing a natural path from GPL -> DSL and back. I guess that's the idea, right? In any case I want it just because of the polymorphic dispatch!

    I am a bit worried about migrating all of my existing Xpand and Xtend stuff and I'll miss the more 'pure' Xpand syntax in that one thing I always liked about that was that it was completely orthogonal to Java syntax.

  2. How about Mixin/Trait support?

  3. @anonymous. We don't have plans for that. Xtend is not meant to be a full replacement for a GPL (i.e. Java).

  4. @sven: okay, I can appreciate that, although the rest of the items on the list makes it sound a lot like a replacement language... Is the language extendable?

  5. Xtend2 looks really nice. But I have some questions.
    - Refactoring
    - Debug support
    - How to show the type of an expression in the editor?
    - Can you create your own type-system?
    - Is there an example that's extending the baselang?

  6. @Brunni:
    - Refactoring

    Xtend supports rename refactoring, even cross language with Java.

    - Debug support

    Is planned for the net release. For now you have to debug through the generated Java code, which is not ideal but ok.

    - How to show the type of an expression in the editor?

    We plan to have local variable hover showing the type for the release in June. Maybe we should have another action invokable on arbitrary expressions.

    - Can you create your own type-system?
    I think you mix up Xbase and Xtend. Xbase is the language library which concsists of expressions only. Xtend is a language we have built with Xbase.
    The typesystem is modeled after the one from Java / the JVM, but it can be populated arbitrary (there is an intermediate layer, i.e. you don't need Java or Byte code)

    - Is there an example that's extending the baselang?

    Xtend is one and Xtext ships with a simple domainmodel language, where you can define entities and such. It supports operation incl. implementation based on Xbase. We have lots of other ideas but, e.g. I have built one for Guice module configuration (see older blog posts).


  7. Hi Sven,

    Can you elaborate on the intermediate layer for populating your own (e.g. non-Java) typesystem? I'm interested in how I might be able to use that.


  8. Great work!!
    What about Xtext 2.0? Is it already available? Where can we find some documentation?

  9. Hi Sven

    I am working on hover cards for myDSL. However, I couldn't find any documentation about Hover implementation with X.Text 2.0.
    Do you have any suggestions?

  10. Is there a reasonable way to use xtend without xtext? I couldn't find download links for any "xtend only" distribution.

  11. Sorry Sven,

    I have to come back to my "pre previous" post. I was looking for a "no-xtext" "xtend-only" distribution but don't seem to be able to find one. xtend seems to be included in the indigo xpand feature but that version does not seem to be the most up to date one.

  12. You need the Xtend2 SDK. It includes and needs a couple of libraries from Xtext, though, because its all build with Xtext. Other than that Xtend is not dependent on Xtext and can be used in arbitrary Java projects.

    Here's the update site: