In April 2009, Tomáš Matoušek created a nifty IronRuby script that demonstrated the sharing of ScriptScopes in the Dynamic Language Runtime (DLR). The examples on Tomáš’ blog post still work.
The script is like the movie Inception, with languages within languages; but at its core shows how the DLR permits object sharing between languages within the same scope. The code itself is IronRuby; the script spins up a new ScriptRuntime and Engine to perform the acrobatics.
NOTE: These two small scripts are now published to my github account
As IronRuby has moved to 1.1.x.x, and supporting the Ruby 1.9.x language, I’ve updated the code a little (essentially, replacing ‘:’ with ‘then’)
In my Pycon-AU keynote, I demonstrated the above piece of fun. Showing Ruby in a Python keynote did not result in my immediate death – just in case, for the forthcoming Kiwi Pycon I decided to rewrite this in IronPython: