Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Coffeescript for Java? In other words X gets compiled to Java [closed]

Is there a language that gets compiled to Java code (not Byte code but Java .. so no Groovy, Scala, Jython, JRuby etc.)?

In other words is there a CoffeeScript for Java?

One of the major flaws I have against Java is that its so damn verbose and that it doesn't have multiple inheritance. It seems reasonably that one could just clean up the syntax add mixins/traits and closures through code generation.

Yeah its not elegant but coffeescript does it.

like image 997
Adam Gent Avatar asked Nov 23 '11 17:11

Adam Gent


3 Answers

Yep, Xtend. It's a new language brought to you by the Eclipse folks: http://www.eclipse.org/xtend/

No multiple inheritance (that would be a fundamental change to Java semantics), but lots of syntactic sugar, just like CoffeeScript.

Also take a look at Mirah: http://www.mirah.org/

like image 70
Trevor Burnham Avatar answered Oct 19 '22 23:10

Trevor Burnham


If you think about it, CoffeeScript compiling to Javascript means you can use coffeescript itself as a Java language. With the latest CoffeeScript (1.1.3) you might need to use Rhino directly because it triggers a JS implementation bug in the current jdk, but outside of that, you should be good to use the compiled js files to interact with Java code. :)

like image 39
Core Avatar answered Oct 20 '22 00:10

Core


I wrote a pre-processor for text files that introduces {s and }s where there was indentation. I called it:

  • Significant-White-Space (SWS)

It is nowhere near stable, and it doesn't address some of the other shortcuts you point out that Coffeescript offers, but it does work as a proof-of-concept.

like image 20
joeytwiddle Avatar answered Oct 19 '22 23:10

joeytwiddle