[MacRuby-devel] Compiler directives
Zach Holt
lists at wzph.com
Sat May 24 14:08:19 PDT 2008
On May 24, 2008, at 1:46 PM, Laurent Sansonetti wrote:
> Currently this is not possible (same in RubyCocoa), but with the
> enclosed patch:
I'll try it out.
> Any idea regarding a shortcut? (Protocol.protocolWithName is too
> long). For example we could automatically convert symbols to Protocol
> objects.
Protocol[:ProtocolName]
Protocol.named( 'ProtocolName' )
:ProtocolName.to_protocol
'ProtocolName'.to_protocol
With the first one, you could alias :conformsToProtocol
to :conformsTo, and have it still read somewhat like the ObjC.
obj.conformsTo( Protocol[:ProtocolName] )
> Also, calling #inspect on a Protocol object currently crashes (because
> it's not NSObject-based, where inspect is defined).
Thanks for the tip.
More information about the MacRuby-devel
mailing list