RE: [Rubydotnet-developer] [ANN]: rubydotnet-0.2.0
Status: Alpha
Brought to you by:
thomas
From: Thomas S. <th...@th...> - 2003-09-22 20:16:40
|
Hi Tim, > Hi Thomas. This looks really great! I've suspended my project > in favour of yours. I like the "implements > System::IDisposable" example. Thanks. > Does your project support calling Ruby from C#? No, you can't embed the ruby interpreter yet. It is a very good idea, though. I wonder what it would take to make it happen? The marshalling code is essentially the same and the same services are necessary for calling back to .net from ruby. Wouldn't it be a simple matter of creating a managed C++ extension that hosts the .net interpreter and makes it require 'dotnet'. The API would then be namespace RubyDotNet { class RubyInterpreter { // Ideally you would have a static createInstance // or just a ctor, but ruby is non-reentrant, so we // would have to settle for public static RubyInterpreter instance { get { ... } } private RubyInterpreter() { ... } public object eval(string rubyString, object[] args) { ... } // Perhaps some convenience methods public object eval(string rubyString) { return eval(rubyString, null); } public bool require(string fileName) { eval("require '"+fileName+"'"); } ... } } Initializing the ruby interpreter is not difficult, so I think it should be relatively easy to implement the necessary method eval() and the ctor. Cheers, Thomas |