Ok, the Execute<T> is convenient enough. In my opinion the highlighted C# code represents a potential interoperability pitfall and will need to be documented well. On the ruby side, I think there are no technical limitations to achieve ruby's string behavior even if the underlying object is an immutable clr string. What do you think? -- henon
On Wed, Mar 4, 2009 at 12:24 AM, Tomas Matousek < [email protected]> wrote: > We don’t plan to make the highlighted code work. However we are going to > make this work: > > > > string s = engine.Execute<string>(“’hi’”) > > > > and also this works: > > > > string s = engine.Execute(“’hi’”).ToString(), > > > > although in this case you need to take care of *null*. > > > > The difference is that unlike Execute, Execute<T> invokes an explicit > dynamic conversion on the resulting type. You can achieve the same using > engine.ObjectOperations.ConvertTo<string>(engine.Execute(“’hi’”)). > > > > Tomas > [...] > In addition to that, it would also be great to have automatic type > conversion on the .NET side too. I'd expect to be able to assign a string > pulled out from the interpreter to a C# string without the need to call > ToString(). For example, > > string s = engine.Execute("'hi'") as string; > > Currently s would be null because the dynamic cast to System.String fails. >
_______________________________________________ Ironruby-core mailing list [email protected] http://rubyforge.org/mailman/listinfo/ironruby-core
