Nick Parker
My ramblings on .NET...

IronRuby Emerges

Monday, 23 July 2007 17:57 by nickp

So John Lam annouced the alpha release of IronRuby, he mentions that they did a lot of work on string and arrays, unfortunately, with the current release .NET types aren't able to execute Ruby mixins. I was hoping to do something like the following:

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

list = System::Collections::ArrayList.new
list.Add(5)
list.Add(10)
list.Add(15)
list.extend Enumerable
list.each {|i| puts i.to_i}


The following code does execute:

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

Application = System::Windows::Forms::Application
Form = System::Windows::Forms::Form
Button = System::Windows::Forms::Button
Point = System::Drawing::Point
Size = System::Drawing::Size
MessageBox = System::Windows::Forms::MessageBox
window = Form.new window.text = 'Testing IronRuby'
window.size = Size.new(250, 200)
button = Button.new
button.text = 'Click Me'
button.location = Point.new(75, 75)
button.click {|sender, e| MessageBox.show 'I was clicked'}
window.controls.add(button)
Application.EnableVisualStyles
Application.run(window)

Of all the windowing toolkits I've seen for Ruby, the .NET Framework is the easiest to read for me, although I'm sure toolkits like Swiby will get noticed, especially due to it's DSL syntax which is the new hotness in the development world these days. Next up, extending the IronRuby Builtins.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   .NET | Open Source | Ruby | Software
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

August 20. 2008 03:31