Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Let's say I really like Ruby and I know Java. What's the deal behind these J* and Iron* languages that allow you to use the syntax of a foreign language to compile them into JVM or .NET bytecode?

Basically, what's the advantage? Is it just because you like the runtime of one language, but not the syntax?

Please advise!

share|improve this question

2 Answers 2

up vote 8 down vote accepted

It moves the burden of maintaining a lot of native platforms away from the language to the JVM. This makes it easier for the language maintainers to handle multiple platforms plus provide excellent performance for the dull, boring tasks of e.g. writing a good garbage collection etc.

The herculean amount of work to provide a good underlying infrastructure is usually not easily seen from the "outside" but it is quite big.

Also the JVM essentially mean that new platforms are almost free to port to. In my job we run Java code on a non-mainstream IBM platform - any well written Java program runs out of the box.

share|improve this answer
1  
+1 for "It moves the burden of maintaining a lot of native platforms away from the language to the JVM" That is why I would target the JVM. –  Jetti Oct 20 '11 at 1:57

The point is, once you get one language to properly run on a given platform and interface with it, you can basically leverage all existent libraries for that platform (with little to no effort depending on the platform).

Much like having Ruby call down to C libraries, you can have JRuby call down to Java libraries. And you might prefer that, for a number of reasons:

  • Java enforces memory safety. So when calling down to Java instead of C, there's less reason for concern
  • Whatever tool/library you want to use is only (or best) implemented for Java.
  • You want to extend an existing Java based system with a language as Ruby.
  • You just like Java.

In short, the Java platform is a huge and rich ecosystem. And being able to leverage it with one of many popular languages instead of being tied to Java is both good for the platform and the communities of other languages.
Your choice of language and platform no longer really depend on each other. That means you won't have to write in a language you don't like to leverage a badly needed platform feature, or that you won't lock yourself out of some platform just by your language choice.

Please note, the above of course applies to .NET, although the Iron-stuff doesn't really seem to have taken off yet as far as I can tell. But given there's F# and Nemerle and the fact that C# also allows for terser programming than Java (with Linq for example) and that despite Mono the .NET eco-system has strong ties to Windows, who knows if it ever will.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.