Hacker News new | ask | show | jobs
by hopeless 5347 days ago
Oh, it looks like Xtend is to Java as Coffeescript is to Javascript. Although I'm sceptical about it compiling to Java source.

Java seems to be going through a period of experimentation, and alternative Java-like and JVM languages. Interesting times.

4 comments

It is also great for using with Android/GWT. Scala can be both used with Android[1] and GWT[2], but it is not a walk in the park.

It seems like a great gateway drug for Scala.

[1] https://github.com/danielribeiro/HelloScalaOnAndroid

[2] http://news.ycombinator.com/item?id=3198154

I agree. I use Scala for a personal Android app. Once you get over the antbuild and proguard hurdle - agree its no walk in the park - its smooth sailing. Scala meshes well with the android libraries and is fast. Although it gets highly wonky if you need to add a library that is not a jar but instead a package.

The major downsides which are super troublesome are that it takes 2 minutes to build each time - even for trivial changes and I have to debug the old school way with messages.

You can speed up the build time a lot by preinstalling Scala on the phone or emulator. This will allow you to skip the Proguard step. Here's how you do it http://zegoggl.es/2011/07/how-to-preinstall-scala-on-your-an...
One of the nice things about compiling to Java source is that it allows you use it with GWT. The only downside that I can see is that there might be constructs that you can't express in Java that you would want in a new language (note that you're fine with ones that you can technically express in Java but are just ugly, like closures). There are probably not very many of them, though.
Well, scala can be used with gwt: https://github.com/scalagwt

It was documented on scala, page, but now you have to use the google cache to see this: http://webcache.googleusercontent.com/search?q=cache:wqqu7uQ...

Exciting! Thanks for the link.
I didn't notice any mention of taking care of the primitive/object divide. That would be high on my wish list.
From a quick scan of the Xtend page, it seems to be fairly backwards compatible with Java source code.
It would be nice to at least have the option to compile to bytecode, but this is a good start. I'm hoping it was just a decision to get the language out there and drum up interest before taking on a bigger project, and a 'real' compiler is on the way.

This one in particular is interesting since it seems to be an attempt to catch up with some of the rapid development C# has made. The Java platform is great, but the language has visibly been allowed to grow moss lately.

Legal JavaScript is legal coffeescript.

Is legal java legal xtend ?

Can we expect something like http://js2coffee.org

Sorry to be pedantic. In JavaScript:

    (function () { });
Would definitely not be valid CoffeeScript. Invalid keyword `function`.