[IronPython] Running Ruby code from Python, which is running in Ruby

Michael Foord fuzzyman at voidspace.org.uk
Tue May 12 00:19:39 CEST 2009


Wow - the Pyjama Project looks very impressive!

Looking forward to trying it out.

Michael

Douglas S. Blank wrote:
> Perhaps you've seen this, but I ran across Tomáš Matoušek’s blog this 
> weekend http://blog.tomasm.net/category/ironruby/ where he describes a 
> little interactive Ruby shell that works something like:
>
> $ irb.exe repl.rb
> rb> class C
> rb|   def say_hello caller
> rb|     puts "#{caller} says hello to Ruby"
> rb|   end
> rb| end
> => nil
>
> Now, he switches languages on the fly:
>
> rb> #py
>
> Now, from Python he imports and runs the Ruby class in Python:
>
> py> import C
> py> c = C()
> py> c.say_hello("Python")
> Python says hello to Ruby
>
> I thought I'd try this in the educational DLR editor/shell that we're 
> developing in C# (at http://pyjamaproject.org/Pyjama ) and it works! 
> There are still some issues (running Python code in Ruby didn't seem 
> to work), and you need the latest drop of the DLR (I used 23458):
>
> http://www.codeplex.com/dlr/SourceControl/ListDownloadableCommits.aspx
>
> which isn't stable. But, the proof of concept is fantastic to see 
> after all of the hard work. Best of all, the same DLLs allow all this 
> to work on Linux and Mac OSX too, thanks to Mono.
>
> This means that you can write and compile a library *once* in whatever 
> language you want, use it from other languages, on whatever operating 
> system you want. Wow.
>
> Thank you to all those that are making this possible! (And more on our 
> DLR IDE soon...)
>
> -Doug
>


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog





More information about the Ironpython-users mailing list