Today I am attending the first Scout User Day 2014 in Ludwigsburg, which is aligned with EclipseCon Europe 2014 starting tomorrow. Yesterday we had a pre-event dinner with some attendees and the organizers at the Rossknecht restaurant. I got into a chat with Nejc Gasper, who will give a talk titled “Build a Scout backend […]
Before Xtend became a general purpose language, it was designed for building code generators and model-to-model transformations in the Xtext framework. And even though this is no longer Xtend's main focus, the related features are useful in other situations, too!
Pretty much every modern language has some way to insert variables into a String template. In Xtend this is called a Rich String and has the following syntax:
Xtend has a nice list of operators you can use out of the box. But you can also overload them for your own types and even for types that others have written. Let's just look at a typical numeric type, Complex numbers:
As you can see, overloading an operator is just done by writing a method whose name matches the operator and its signature. [...]
This is the feature that gave Xtend its name and one of its most powerful tools. At the same time it is one of the least understood features among beginners, so I'll give you a head start.
Extension methods can be called on instances of their first parameter type as if they were defined in that type. That's quite a mouthful, so let's just look at an example:
Xtend comes with a lot of syntactic sugar that makes your code more readable. In this post we will look at the basics and see how you can make your code much shorter even without learning Xtend's advanced features.
Let us take this simple snippet of Java code as an example and make it more readable step by step.
For starters, here is the 1-to-1 translation [...]
Xtend is a statically typed programming language that compiles to readable Java code. It stays true to Java's type system and libraries, giving it the best interoperability of all the popular JVM languages. On top of that it adds a lot of syntactic sugar and powerful abstraction features that really cut down on the boilerplate you have [...]
EclipseCon Europe is just around the corner, so it is time for some shameless self-promotion ;) Among the many awesome talks on Xtend and Xtext will also be one given by me and my colleague Sebastian Zarnekow.
Tue 16:45 to 17:20: New & Noteworthy in XtendIn this overview we will show you many great features that were added in the 2.6 and 2.7 releases. Among them are inner classes, swifty lambda sugar and improved operator overloading. The small standard library also got some often [...]
The Xtext framework has been in development for six years now. With a team size between five and nine people (we are now at nine) plus many contributors working on it, it has become a successful framework for development of domain specific languages and programming languages in general. From parsers, linkers and compilers to interpreters, type-checkers and full IDE-support, the framework covers everything a grown up language infrastructure needs. So far however, the IDE part has been Eclipse-only. [...]