I actually tried this, but the problem seems to be that Protocol is not a true 
class. So if I try to do anything with the protocol parameter from MacRuby, I 
get an error:

*** NSInvocation: warning: object 0x7fff71192488 of class 'Protocol' does not 
implement methodSignatureForSelector: -- trouble ahead
*** NSInvocation: warning: object 0x7fff71192488 of class 'Protocol' does not 
implement doesNotRecognizeSelector: -- abort

Even just comparing it to another protocol object using protocol == 
Protocol.protocolWithName('...') leads to the same result.

Any ideas as to how this could be made to work?

On Nov 16, 2010, at 19:59 , Eloy Duran wrote:

> I don't have an example of a class that uses conformsToProtocol: on the 
> delegate, so I can't give you a code example, but I would try to override the 
> conformsToProtocol: class and instance methods and return true for those you 
> support.
> 
> On 15 nov 2010, at 00:15, Martijn Walraven wrote:
> 
>> Hi,
>> 
>> I was wondering if there is any way to formally indicate a MacRuby class 
>> conforms to an Objective-C protocol. I encountered some code that uses 
>> conformsToProtocol: instead of respondsToSelector: as a check before 
>> invoking delegate methods, and the only way I could get a delegate written 
>> in MacRuby to work was to create an Objective-C class with the same name and 
>> specify the required protocols in the interface declaration there.
>> 
>> Thanks,
>> 
>> Martijn
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to