[MacRuby-devel] accessing ruby objects from Objective-C

S. Woodside sbwoodside at yahoo.com
Tue Feb 10 20:37:04 PST 2009


On 2009-02-10, at 4:10 PM, Benjamin Stiglitz wrote:

>> I describe calling ruby side objects from the ObjC side. I can make  
>> it work using dynamic classes but of course that generates compiler  
>> warnings (like no '-baz' method found). Of course it still works,  
>> but is there any way for my ObjC classes to know at compile time  
>> what are the class names and methods on the ruby classes?
>
> Not really, since this list is potentially dynamic.

You mean like with define_method? Something like this could also  
happen in ObjC anyway, using forwardInvocation: ... although that's  
really more like method_missing. In fact I think I even used it that  
way a few years ago :-)

Certainly it "looks" the same to the caller either way...

> That being said, it’d be nice if the runtime could dump a header for  
> the current state of a class, ScriptingBridge-style. I might look  
> into this.

That would be awesome. Something like sdef/sdp for Ruby classes maybe  
those tools would be useful already.

--simon


More information about the MacRuby-devel mailing list