Note in Programming page
Created Jul 29 10, Updated Mar 17 11 11:47
The Mirah Programming Language  go to comments

From the O’reilley OSCON 2010 Emerging Languages Camp (seen via an infoQ interview of Charles Nutter – mister JRuby – by Werner Schuster)

A Blend of Java and Ruby

(haven’t tried it yet… anyway is not mature and looks no better than scala except that is doesn’t require any non Java core lib)

http://www.mirah.org/wiki/MirahFeatures

In general, Mirah could be seen as a “Ruby with static types”, though Mirah is not Ruby. It does not share Ruby’s type system, core classes, standard library, or even execution model, since none of these things are imposed upon Mirah programs by the Mirah language.
Mirah is more a repurposing of Ruby’s syntax to a flexible toolchain suitable for compiling to any number of type systems and runtimes with maximum performance.”

http://www.infoq.com/articles/mirah-interview

At present, it seems the best way to describe Mirah is as “a nicer way to write Java.” So I’d say the primary target right now is Java developers that want a replacement for javac with a nicer syntax and a few additional features.
...
It turns out that the Java libraries and most of the Java type system aren’t really that cumbersome if you put a little sugar around them. For me, the best sugar available comes from Ruby syntax and some of Ruby’s “apparent” language features.
...
Mirah is a statically-typed, compiled language, but it runs well as a script too. You write what mostly looks like “Ruby with a few type annotations”, and then either use the “mirah” command to run it as a script or the “mirahc” command to compile it to JVM bytecode or Java source.

How will it stand against jRuby performance and productivity wise ? Will it be soon really usable? How fast is it? ... How could it stand against Scala?

# dynamic.mirah:

def foo( a:dynamic )              # dynamic typing
  puts "I got a #{ a.getClass.getName } of size #{ a.size }" 
end

class SizeThing

    def initialize( size:int )    # static typing
        @size = size
    end

    def size
        @size
    end

end

#foo( [ 1, 2, 3 ] )
#foo( SizeThing.new( 12 ) )
You can use both static and dynamic types: nice!
# sort_closure.mirah :

import java.util.Collections
import java.util.ArrayList

list = ArrayList.new [ 9, 5, 2, 6, 8, 1 ]
puts "unsorted: #{ list }" 

Collections.sort( list ) { | a, b | Integer( a ).compareTo( b ) }

puts "sorted: #{ list }" 
You can use code blocks that made ruby so (functional) and “beautiful”

Btw, I don’t understand why people are so attached to ’;’ and tons of parenthesis and curly brackets (even ’:=’) ? Many new languages keep those, maybe to avoid scaring old programmers? (e.g. AmbientTalk – a distibuted event-driven language – looks great if it was not for its syntax). With Mirah, striping an old language of it’s ugly and heavy -ness is refreshing! (but Scala already did the same)


Add a comment:

(required)

(will not be published) (required)

(optional)