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

Twitter Digg Delicious Stumbleupon Technorati Facebook Email

192 Responses to “A first look at IronRuby”

  1. Random Ramblings Over Ruby On Microsoft .NET

    Martin Fowler argues that IronRuby gives Microsoft the opportunity to collaborate with, and extend its

  2. @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.

  3. A Web-Based IDE for Distributed Programming Part 2

  4. A Web-based IDE for Distributed Programming Part 2

  5. 2007 OSCON-season announcement bonanza

    First John Lam announces Iron Ruby, to be released under something called the Microsoft Permissive Licesnse. It’s basically a rebranded Apache license — and honestly, seeing that stuff on an MS-branded Web page had me imagining some alternate-reality Ste

  6. First Look at IronRuby

    Over the last few years weve been working to make .NET and the CLR a great environment for dynamic

  7. 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?

  8. IronRuby 動かしてみた

    Ruby for .NETな、IronRuby来てますね Rubyのプロジェク…

  9. @Adrian – I haven’t run across this before – I’m assuming that you don’t have a corrupt ZIP?

  10. 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?

  11. 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.

  12. @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.

  13. 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?

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

  15. Why use RSpec / BDD?

    Behavior-Driven Design and specifically the RSpec implementation have changed the way I view unit tests. I commented in a mailing list that I hoped IronRuby would support RSpec. Ive used it on a Java project using JRuby and it works fine, but the m

  16. Current things on my plate

    Im doing a good deal of stuff lately: 1. Helping build/standardize the local .NET Users group in

  17. 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

  18. @ 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.

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

  20. 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

  21. Microsoft and Open Source

    It never fails that when I am introduced to a big Open Source supporter one of the first things I hear

  22. Microsoft and Open Source

    It never fails that when I am introduced to a big Open Source supporter one of the first things I hear

  23. 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?)

  24. A Web-based IDE for Distributed Programming Part 2

  25. A Web-based IDE for Distributed Programming Part 2

  26. How Software Is Built – Open Source and Closed Source

    How is software built in the real world? How are open source and closed source development projects different?

  27. How Software Is Built – Open Source and Closed Source

    How is software built in the real world? How are open source and closed source development projects different

  28. Open Source Projects on Windows

    Heading into a long (and quiet) weekend for many folks in the US, I thought I would highlight some useful open source projects on Windows, particularly after reading eWeek’s gallery of the Top 25 Most Active Open Source Projects on Codeplex. There’s s…

  29. IronRuby 初览

    【原文地址】FirstLookatIronRuby
    【原文发表日期】Monday,July23,20078:45AM
    过去的几年里,我们一直致力于使得.NET和CLR成为出…

  30. advantages of learning english language

    advantages of learning english language

  31. texas high school sports network radio

    texas high school sports network radio

  32. 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

  33. 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

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

  35. Observations from MS Patterns

    Observations from MS Patterns

  36. Hello!!! Thanks for your contribution! All our staff was waiting, and we are happy to play with rubby now.
    http://alierra-software.com

  37. 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.

  38. Open Source Projects on Windows

    Heading into a long (and quiet) weekend for many folks in the US, I thought I would highlight some useful open source projects on Windows, particularly after reading eWeek’s gallery of the Top 25 Most Active Open Source Projects on Codeplex. There’s s…

  39. Community Projects on Codepldex

    Heading into a long (and quiet) weekend for many folks in the US, I thought I would highlight some useful open source projects on Windows, particularly after reading eWeek’s gallery of the Top 25 Most Active Open Source Projects on Codeplex. There’s s…

  40. Community Projects on Codeplex

    Heading into a long (and quiet) weekend for many folks in the US, I thought I would highlight some useful open source projects on Windows, particularly after reading eWeek’s gallery of the Top 25 Most Active Open Source Projects on Codeplex. There’s s…

  41. 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.

  42. Community Projects on Codeplex

    Heading into a long (and quiet) weekend for many folks in the US, I thought I would highlight some useful open source projects on Windows, particularly after reading eWeek’s gallery of the Top 25 Most Active Open Source Projects on Codeplex. There’s s…