Question

What does Mirah language offer over JRuby,Groovy and Scala?

Was it helpful?

Solution

According to an interview with Mirah's creator the point of Mirah (which means "ruby" in Javanese) is to create a high-performance variant of Ruby. Enough Ruby-like syntax to make it comfortable to work with, but still close enough to Java and JVM semantics so that it can run without the overhead of a big runtime layer on top of the JVM.

Choice quote:

Much of the benefit of Mirah over similar languages comes down to being so lightweight. In Groovy, Scala, JRuby, Clojure, or Jython, the minute you write "Hello, world", you've shackled yourself to a runtime library. In Mirah, "Hello, world" is just as terse as in JRuby, but has the added benefit of not foisting any dependencies on you; source file goes in, class file comes out, and that's it. I believe the JVM needs a new dependency-free language, and Mirah is my attempt to deliver one.

While JRuby's performance rivals or exceeds other Ruby interpreters, the fastest JRuby code still lags pure Java performance by an order of magnitude. While you can expect the performance of JRuby to improve with the 1.6 release, Mirah is an attempt to break through the performance ceiling and provide an option for programmers looking for execution speeds on par with Java code.

OTHER TIPS

Unlike full-featured languages, which come with their own libraries, Mirrah is more like a different "frontend" to the Java libraries.

Mirrah code does not depend on it's own environment (except the Mirrah compiler at compile time).

That's the main benefit: A different syntax for Java.

vs. Groovy

  • Syntax more familiar to existing Ruby/JRuby programmers
  • Statically typed

vs. JRuby

  • Statically typed

vs. Scala

  • Syntax more familiar to existing Ruby/JRuby programmers

The MAIN advantages are static typing (faster performance on the JVM and much easier interop with existing Java libraries) and a familiar syntax (if you come from Ruby).

When dependencies are a consideration (developing an android app, for example) then you shouldn't let this guide your language choice. Using a tool like Proguard will level the playing field.

If you're coming from Ruby, then Mirah is a good choice. If you're coming from Erlang or Haskell, then you'll want Scala. If you're a LISPer, then you'll want to take a look at Clojure.

If your only prior experience is Java then Shame on you! - and you should probably go for Scala - It's rapidly gaining a reputation as the heir apparent to Java, tool support is currently stronger and you'll be in a large community of others who made the same transition, so there are plenty of blogs/tutorials already available.

and Groovy? Groovy is almost never the right choice nowadays...

I use Mirah everyday on Google AppEngine.

Here are my reasons to use Mirah:

  • no runtime library
  • very nice syntax
  • as fast as Java

Having Java under the hood is very helpful too:

  • solid typesystem
  • well documented
  • known solutions for common problems

I did some Groovy, lot of JRuby and none of Scala. If you know these, try Mirah. If not, I'd go with JRuby.

Mirah is just another rubyish syntax for java. IMHO not good at all. It knows nothing about generics, and also has poor tooling. Better try ceylon, xtend, scala, kotlin etc.
Mirah compiles to java classes (not sources anymore). Xtend compiles to java sources and so simpler to found out what it does under the hood. Ceylon and scala have their own stdlibs (nevertheless java interop is near to perfect in them both), not sure about kotlin. Kotlin is JetBrains' child and thus tied to IDEA.
JRuby I don't like too. It has too many bugs in java interop. And it also have too many reinvented wheels. I mean encodings (it does not use java strings and regexes but custom strings on top of raw byte buffers), IOs, exception handling, threads etc.
The only advantage of jruby is that it is ruby. Many ruby code will just work as it is.
Groovy OTOH does not reinvent the wheel, it uses well tested java libraries and just adds syntax sugar too them. Also groovy-java interop is great. It can generics. Threads, exceptions, strings, collections - are just java classes as they are in java.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top