Ivan Porto carrero wrote:
> You can only reach it by adding the class as receiver.
> 
> but you can use method missing as a dispatcher:
> 
> alias :old_mm :method_missing
> def method_missing(method_name, *args, &block)
>    return MyCSharpClass.send(method_name, *args) if 
> MyCSharpClass.respond_to?
> method_name
>    old_mn method_name, *args, &block
>  end
> 
> 

Thanks, it's a nice workaround, i didn't know about the 
"method_missing". Is there any way to do it C#, through the DLR (i 
didn't see anything about this, as it's obviously language dependent) or 
custom IronRuby classes? The reason is i have a lots of method that 
would be called this way and i would like to use the most efficient way 
to do it.

On a similar subject, is there a way to resolve dynamic variable at 
runtime? Like, a user type a variable that was not declared, but the DLR 
host is able to create on the fly an object for this variable and return 
it. Is it possible? Is "IDynamicMetaObjectProvider" and 
"IAttributesCollections" on CreateScope() are used for that?

> FYI, we’re thinking about allowing you to use “include” with .NET types, 
> which will include it’s static methods. That would enable:
> include MyCSharpClass
> puts mymethod "foo"

Good, i used this similar method in IronPython, so IronRuby probably 
deserve this kind of static import!

Thanks for your quick response.

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to