John Lam 1997 — 2026

Why not a Ruby.NET?

Building a native Ruby implementation on the CLR is an ambitious goal. John Gough and associates are attempting to do exactly this in their Ruby.NET project. This is a much harder problem than it looks, and kudos to John for even attempting it. The semantics of Ruby are significantly different than other CLR languages.

As a simple example, consider the fact that Ruby does not allow method overloading. How would you construct a Ruby type that must override methods in an abstract base class that differ only based on their signatures?

Another example is the case where you want to surface CLR features natively in Ruby. How, for example, will you declare a generic array in a language that does not support type declarations?

Last but certainly not least are the sophisticated features in Ruby such as continuations that make it very challenging for an implementor to implement efficiently. This feature requires a stack copying mechanism that isn’t a native feature of the CLR. Can such a feature be added to the CLR without compromising the performance of existing languages? This is not clear, and was one of the topics that came up for discussion during the dynamic languages BOF at OOPSLA.

6 archived reader comments

Jason Bock (2005-10-27)

Eiffel is another language that does not support method overloading and there’s a .NET compiler for Eiffel. May be worth a look to see what they had to do to handle the case you mentioned - this link talks a bit about what they do to handle this:

http://docs.eiffel.com/eiffelstudio/technologies/dotnet/eiffeldotnetlanguage/10conventions/20names.html

Regards, Jason

John Lam (2005-10-27)

Thanks for the link, Jason.

Wow. That is the most verbose solution that I’ve ever seen! Maybe when Ruby gets attributes (Matz talked about adding it in 2.0) I could use them to disambiguate. That is, of course, if I ever even attempt that part of the project :)

Tom Janssens (2005-10-28)

While there is no native implementation of Ruby.Net, there is a language that closely resembles ruby, developped as a new language on top of the CLR platfom : BOO

http://boo.codehaus.org/

It supports much of the ruby aspects.

Florian Gross (2005-10-29)

I was also sort of part of a Google Summer of Code project that tried to implement Ruby.NET for Mono. This project has not yet gotten far, but there’s some code in SVN and you might be able to join forces with us (I was supposed to be the run time guy, but work on that hasn’t really started. Not sure if I still have enough time for it, either, but it’s certainly worth a try.)

The code’s at svn+ssh://mono-cvs.ximian.com/source/trunk/rubynet

Oh, and nowadays I think that doing this in a self-hosting way would be best.

There already is various Ruby<>.NET bridges available on the .NET. I’d use them to call System.Reflection.Emit from Ruby. You don’t even need to initially write a parser because Ruby comes with Ripper.

It would probably still be a good idea to at least initially implement the standard library of Ruby in C# just so that performance isn’t all bad and to keep things simple.

Having a full self-hosted Ruby in Ruby on .NET implementation would be very flexible. It would allow changing the language in itself which is insanely powerful.

Doing all this in a test-driven way would also be priceless.

Isn’t there some kind of place where folks interested in this could talk together and team up? It seems to noble a project not to do so. Please mail me if anyone of you decides to set something like this up. I’m definitely interested.

John Lam (2005-10-30)

Thanks for the update, Florian. I was wondering what had happened to your project. I’ll take a look at your code when I get some cycles (probably next week) and I’ll probably mail you some questions (probably via ruby-talk?) then.

sara (2006-06-20)

Thanks for the update, Florian.