When I saw that IronRuby had been released I thought I’d put it through its paces seeing how the language preformed with respect to IronPython and of course F#. Perhaps a little unfair for a number of reasons, firstly this is a pre-alpha release so one can’t really expect much, we need to give it time to mature and two, ruby generally performs slow than python in the “Computer Language Bench Mark Game”, (http://shootout.alioth.debian.org/) so one wouldn’t really except IronRuby to outperform either IronPython or F#. However I thought what the heck and downloaded the source for the ruby bench marks.
I was a disappointed with what I found, every single one of the programs crashes. And even worse it difficult to tell exactly why they failed. I’ve listed here the command lines that I ran along with abridged versions of the exception I got:
>rbx.exe /run:binarytree.rb
Unhandled exception:
System.NotImplementedException: Statement transformation not implemented
at Ruby.Compiler.AST.Statement.Transform(AstGenerator gen) in Statement.cs:line 31
>rbx.exe /run:fannkuch.rb
Unhandled exception:
System.NotImplementedException: Statement transformation not implemented
at Ruby.Compiler.AST.Statement.Transform(AstGenerator gen) in Statement.cs:line 31
>rbx.exe /run:nbody.rb
Unhandled exception:
System.NotImplementedException: TODO
at Ruby.Compiler.AST.InstanceVariable.TransformWrite(AstGenerator gen, Expression rightValue) in InstanceVariable.cs:line 31
>rbx.exe /run:nsieve.rb
Unhandled exception:
System.NotImplementedException: Statement transformation not implemented
at Ruby.Compiler.AST.Statement.Transform(AstGenerator gen) in Statement.cs:line 31
>rbx.exe /run:partialsums.rb
Unhandled exception:
System.MemberAccessException: uninitialized constant ARGV
at Ruby.Runtime.RubyOps.GetConstant(CodeContext context, Object target, SymbolId name) in RubyOps.cs:line 349
>rbx.exe /run:pidigits.rb
Unhandled exception:
System.NotImplementedException: TODO
at Ruby.Compiler.AST.InstanceVariable.TransformWrite(AstGenerator gen, Expression rightValue) in InstanceVariable.cs:line 31
>rbx.exe /run:recursive.rb
Unhandled exception:
System.MemberAccessException: uninitialized constant ARGV
at Ruby.Runtime.RubyOps.GetConstant(CodeContext context, Object target, SymbolId name) in RubyOps.cs:line 349
I decided it might be nice to try and fix at least some of the programs, after all I reasoned, the programs are all pretty similar and some of the exceptions are the same, perhaps there all just using some obscure feature of the language that can be easily worked round. I worked out that ARGV was a command for access command line parameters, I replaced this with a hard coded value in both partialsums.rb and recusive.rb that had both failed because of this. Both now failed for other reasons.
>rbx.exe /run:partialsums.rb
Unhandled exception:
System.MissingMethodException: undefined local variable or method `upto' for 1:Fixnum
at Ruby.Builtins.Kernel.MethodMissing(CodeContext context, Object self, Procproc, SymbolId name, Object[] args) in Kernel.cs:line 169
>rbx.exe /run:recursive.rb
Unhandled exception:
System.MissingMethodException: undefined local variable or method `printf' for #
<Object:0000002b>:Object
at Ruby.Builtins.Kernel.MethodMissing(CodeContext context, Object self, Proc
proc, SymbolId name, Object[] args) in Kernel.cs:line 169
At this point I gave up. I although I appreciate this early access we are being given to the IronRuby project, maybe this is a little too early? It seems like this particularly drop of the code is just too raw to be much use.
Don’t get me wrong I don’t want to seem anti-ruby, there are a number of positive things about the release – particularly the very liberal license, the fact it will be hosted on RubyForge and the fact that they will be accepting community contributions for the libraries. In fact I’m so intrigued by Ruby I’ve actually ordered a book Programming Ruby by Dave Thomas, Chad Fowler and Andy Hunt, I’m particularly interested in how creating DSLs in Ruby differs from creating them in an ML style language (i.e. F#). All I’m saying is maybe the IronRuby team would have been better holding off the release a wee bit longer and delivering something a little more complete.