#1709 What do you think about Xtend?

Akcelisto Thu 24 Nov 2011

Xtend is new language that complies into Java.

What do you think about Xtend?

brian Fri 25 Nov 2011

Xtend strikes me as very close to what Charles Nutter is trying to do with Mirah, and a lesser extent most of the traditional JVM langs like Gosu, Ceylon, Kotlin, maybe even Scala. What they are all trying to do is create a new language, but keep the existing Java ecosystem of libraries, frameworks, and tools.

I personally think its the Java ecosystem and its libraries that needs to get thrown away, not the Java language itself. I think this will be especially true once Java finally gets closures. The Java culture has created an ecosystem of libraries that are often what I like to call "over abstracted, and under powered". That is obviously a blanket statement that doesn't apply to all Java frameworks or libraries. But when I look at Java projects, to me the greatest source of complexity isn't the bloated Java boiler plate code, but rather the fundamental design of the libraries and code itself. The Java culture rarely bases its design on simplicity. And the result is that Java projects tend to be massive teetering towers of 100s of "modules", each with own huge surfaces areas.

So even though many like to classify Fantom as a JVM language, we didn't build Fantom as a better language to keep using all the existing Java libraries. Rather we build Fantom for ourselves to replace all that crap. Now from a pragmatic approach, that takes time and it makes imminent sense to reuse existing Java functionality when you can. But ideally you want to package it up cleanly into isolated cases using good modularity (don't think we've done a good job of that yet). But at the same time, it is telling that we have been able to build our entire SkySpark stack without a single Java FFI call.

So just to summarize, Fantom's main goal is to replace not the Java language, but its libraries and rethink of the entire platform where simplicity is the guiding light.

DanielFath Sat 26 Nov 2011

So just to summarize, Fantom's main goal is to replace not the Java language, but its libraries and rethink of the entire platform where simplicity is the guiding light.

+ Inf

My thoughts on Xtend are brief. I like the switch-case construct and extension methods and would perhaps like to see it in Fantom... Rest is already in ;)

PS. Minus Generics.

svenefftinge Sun 27 Nov 2011

Given Fantom's scope to run on CLR, JVM and in the browser, it makes good sense to define a new standard library. After all you want to run the same code on the various platforms.

But selling a small, unused, non mature library with close to zero external libraries built on it as a pro is ridiculous. It's a compromise and mostly useful if you want to run your code on other platforms than the JVM.

The Java SDK is a mature and carefully evolved standard lib, with relatively little but well known problems in it. There are around 10 million developers out there working with this library on a daily basis and even more importantly all the super cool Java-based tools and frameworks you can find on the internet integrate with the Java SDK.

Yes, it doesn't define (many) higher-order functions, since the language still lacks closures. Also functionality is added carefully, which on the one hand helps to reduce the mess that usually piles up over time. On the other hand a lot of convenience functionality is missed.

In Xtend this problem is completely solved with extension methods. Xtend comes with a thin library adding the ubiquitous higher-order functions to Java's collection library as extension methods and you can even easily add any kind of methods on any type from the JDK yourself.

jodastephen Sun 27 Nov 2011

(For those reading this thread, svenefftinge is the lead architect of Xtend - which Sven probably should have mentioned)

Personally, I agree with Brian that the core JDK library is part of the problem. Not that I agree with all the choices the Fantom library makes, but it does a good job. So yes, the JDK is mature, but not in a good way - think crusty and ripe cheese rather than mature and flavoursome.

An extension method can help you add missing functionality to the JDK, but it cannot take away the complex and bloated parts of which there are many. A core library written with closures is very different to one written without, both in methods and class design. Papering over the cracks is helpful, but not sufficient to really move beyond Java. But for Xtends goals, extension methods make perfect sense.

Its important to also realise that with Fantom you don't need an external testing library, an external logging library, an external build library, an external XML library, and so on. As such, many of the external libraries you might expect to find in other languages aren't needed - as they are provided.

qualidafial Mon 28 Nov 2011

But selling a small, unused, non mature library with close to zero external libraries built on it as a pro is ridiculous.

One could have made the same argument against Java when it started out.

Personally I quite enjoy working in Fantom. We haven't yet reached parity with the libraries available to us in Java or other languages, but what we do have is clean and simple. It's nice to code in a language that doesn't make you scrape off the barnacles first. :)

dobesv Thu 8 Mar 2012

I can't be happier to see java.util.Date and java.util.Calendar disappear. And the duality of HashMap vs Hashtable, Array vs Vector. The java core libraries have got an accumulation of baggage that I think there is a benefit to leaving behind.

On the other hand, it's fair to say there's a lot of stuff already written for Java. So, to each their own.

Some people like to be more pioneering and rebuild everything in a new language, whereas other will prefer to benefit from the existing infrastructure despite its warts.

So far I'm having fun with Fantom. I do miss a few things from Java - not the libraries, so far - but for example generics would be nice because they improve code re-use / documentation. I've already copy/pasted one class because it had to have a different type for one of its members, I could have used a Generic class instead.

Login or Signup to reply.