« IronRuby plans revealed on .NET Rocks | Main | OSCON Wrap-up »

July 23, 2007

A first look at IronRuby

IronRuby code gen

We've been working very hard over the past couple of months to get our first source code release ready. I'm happy to announce today the first drop of the IronRuby source code. IronRuby is licensed under very liberal terms as set out by the Microsoft Permissive License.

We're also happy to announce that we will be accepting source code contributions into the IronRuby libraries. Right now we have a lot of logistical work that we still need to do, but we fully intend on getting IronRuby onto Rubyforge by the end of August.

Some of you may be wondering why we are only accepting contributions into the libraries and not the entire compiler. It's because IronRuby is built on top of the Dynamic Language Runtime (DLR), and the public interfaces to the DLR are not complete at this time. Since the DLR will ship as part of the CLR in the future, we cannot accept contributions into the IronRuby compiler, at least initially. However, once the DLR matures and reaches 1.0 status with fully supported public interfaces, we will fully open up all parts of the IronRuby project for external contributions.

To start playing with this release, you'll need to build IronRuby. This release of IronRuby requires the .NET Framework 2.0 Redistributable. Just unzip the source code file, and run the build.cmd batch file to create a release-mode build of IronRuby.

You can kick the tires by typing some code interactively using our simple REPL console application. You'll find it at \bin\release\rbx.exe. You should add \bin\release to your path to make your life easier.

Next you should look at the unit tests under \tests\ruby\builtins. This will give you an idea of what works and what doesn't work in IronRuby. We've put most of our effort into Array and String; any other support that's in the libraries was put in there to support building Array and String features.

We have .NET interop working out of the box; you can import .NET libraries into your Ruby programs via require:


require 'mscorlib'
require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Notice how you need to use the fully-qualified assembly name in require.

We don't have include working yet at top-level scope, so you'll need to either use fully-qualified type names or assign them to constants:


Window = System::Windows::Forms::Window

We also have pretty good performance in this release. We use a DLR feature called Dynamic Sites, which is our implementation of adaptive call-site method caching. Other than using Dynamic Sites, we have not done any other specific performance tuning for this release.

In micro-benchmarks which measure method call performance, we are significantly faster than Ruby 1.8.6. In micro-benchmarks which measure library performance, we are on par with Ruby 1.8.6; we expect to see performance improvements in these benchmarks in the future. In micro-benchmarks that involve raising exceptions, we are slower than Ruby 1.8.6; but if control flow on your program's critical path involves raising exceptions you may want to rethink your design :)

We're really interested in hearing what you have to say about this release. I'm at OSCON all week, so feel free to come up and say hello if you're attending. My IronRuby talk is this Thursday at 5:20pm, and I'll be busy cooking up a fun demo for that talk between now and then. If you're not at OSCON, feel free to send mail to jflam at the big software company in Redmond.

Last but most important, I'd like to thank the members of the IronRuby team: Tomas Matousek, and Haibo Luo for their hard work in getting this release out the door. Great job, guys!

Update

Some additional posts worth reading:

Scott Guthrie, who has a nice sample on using IronRuby with WPF

Jason Zander, on working with the open source community

Miguel de Icaza, for an outside perspective of our changes as a company

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/t/trackback/2419952/20261072

Listed below are links to weblogs that reference A first look at IronRuby:

Comments

Congrats on this pre-release, John.

I've written a tutorial about hacking IronRuby ro modify it or extend it using the Visual C# IDE:

http://www.yashlabs.com/wp/?p=145

Best

@Josh:

Thanks so much for doing this! I'll make sure to call out your work in my IronRuby wrap-up post tomorrow!

(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software

@truthhurts:

This is a standard attribution clause that you will find in virtually any piece of open source software.

Hi John,
I was looking over the source code of IronRuby and was wondering if there is an implementation of CodeDomProvider for IronRuby. As far as I could make out there is nothing like RubyCodeDomProvider. Do you intend to provide a CodeDomProvider for the next version? I've looked over the IronPython CodeDomProvider code and it seems that the implementations should be quite similar. If you could give me any input in this direction, it would be very much appreciated.

@Tudor:

It's on the roadmap to implement a CodeDomProvider for IronRuby. But right now it's a ways off since there's a lot of core language features to implement before we get that far.

John

I am getting a problem when running the build.cmd. The class 'Tokens' can't be found. I notice there is a NEW_PARSER conditional - should this be set?

@Adrian - I haven't run across this before - I'm assuming that you don't have a corrupt ZIP?

John

I don't think my .zip is corrupt.

When I load the solution into MS Visual Studio 2005, the Token.cs unit is in the Compiler sub directory of the Ruby project and the enum Tokens class is disabled by the '#if NEW_PARSER' statement?

Outstanding. So happy to play with ruby. I was so happy to see wpf working in ruby. Quick question, right now the implementation is a interperter mode, is there any plan to make this as compiler to create exe?

Thanks a lot.

@dbcuser: The current implementation i not an interpreter - it's a just-in-time compiler. All of your Ruby code is compiled into IL before it is run. Right now we don't compile to a stand-alone EXE or DLL. But that may change in the future.

Thanks and WPF part is facinating and I was able to build nicelooking GUIs in no time.

I am very much interested in using IronRuby (as I am a ruby fan) instead of some of my c# programs. When do you think 'future' will be? in 6 months or a year?

@dbcuser: 6 months to a year is about the right timeframe :)

Hi John,

Giving few starterkits in Future for IronRuby that works with asp.net would be one of the greatest Idea.

Starterkits played a major role in the sucess of Asp.Net.

Converting few of the most popular Starterkits today to IronRuby will really become the most important topic for all Ruby Lovers.

You can assign this job today to few of your team members for future.

Hope you will apprecaite this

@ SoftMind,

Hi,

I just created a detailed blog for Starterkits.

Here it is:-
http://ironruby.blogspot.com/2007/08/starterkits-in-ironruby.html

Thanks SoftMind for your inspiration and innovative thinking.

John,
Thanks and 6 months not really bad at all.

Now, this is the most impressive announcement from Microsoft since long.
I am too happy and just put my hands on it.
i have just blogged about it at http://ashishwave.wordpress.com/2007/08/12/ironruby-ruby-running-on-net-microsoft-project

and it includes a link for those guys who are want to skip the ironruby source code compilation step, i have uploaded a pre-compiled binary distribution (of your source code ) at http://www.esnips.com/nsdoc/84afe4f5-68b9-45cf-940a-46fdf6c331cc


bye :-)
Ashish Ranjan
ashishwave@yahoo.com

It won't build on my machine. I get several of these:

Compiler\Parser\Tokenizer.cs(2269,17): error CS0246: The type or namespace name 'Tokens' could not be found (are you missing a using directive or an assembly reference?)

I've been study ROR for the past 8month (begineer) and now getting a starting with .Net especially ASP/Sharepoint. Do you have any advise for me on how I can incorporate ROR with .Net.

Thanks for you time.

Yunusa - 571-264-2776

I've been study ROR for the past 8month (begineer) and now getting a starting with .Net especially ASP/Sharepoint. Do you have any advise for me on how I can incorporate ROR with .Net.

Thanks for you time.

Yunusa - 571-264-2776

...this is really cool. Thanks for the awesome information.

Hello!!! Thanks for your contribution! All our staff was waiting, and we are happy to play with rubby now.

http://alierra-software.com

Hi,

Any plans to introduce tutorials for IronRuby.

It would be a nice thing if some one starts few regular blogs explaining IronRuby with few codes that will work for .Net.

Ruby on rails tutorials with IronRuby will also be a nice example.

IronPython has Studio Python ( IDE ) to work with Ironpython on .Net.

Does IronRuby have something similar, to work and learn till IronRuby is matured.

One has to start learning before IronRuby actually arrives.

You would have to be an idiot to even think about using an MS implementation of another language. Remember MSJVM? Embrace, Extend, Extinguish?

Never again.

Post a comment

If you have a TypeKey or TypePad account, please Sign In

Photos

  • www.flickr.com
    This is a Flickr badge showing public photos from John Lam. Make your own badge here.

Recent Comments

Recent Posts

May 2008

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Blog powered by TypePad