Hi Łukasz,

On May 22, 2009, at 1:58 AM, Łukasz Adamczak wrote:

an NSNumber object should do it.

Laurent, thanks for the answer. I believed that was the case.

What about the delegate method case, though? I mean, the framework I'm
playing with expects a certain delegate method and passes C unsigned
ints to it:

http://github.com/lukhnos/objectiveflickr/blob/b480aa39fa0e96f40a1b44523e0b6f918b2ed441/Source/ObjectiveFlickr.m#L525

In this case I have no say in the Objective-C side of things. I write
only Ruby code. The only thing I can do is to not implement the method
at all (and lose some functionality provided by the framework).
Obviously in an open-source environment I'm free to patch the library
to my liking, but that's not optimal and not always possible.

There may be more cases like this. Unless there is a policy on not
using primitive types in delegates (is there?), more libraries (or
maybe Cocoa itself?) can have problems with MacRuby.

MacRuby can deal with specialized delegate methods like this one, but you need to generate a bridgesupport file for the framework you're targeting. Most frameworks that ship with Mac OS X are already covered, but in your case you might want to manually cover ObjectiveFlickr too.

You can learn more by reading the gen_bridge_metadata(1) or BridgeSupport(5) man-pages.

What's going to happen is that informal protocols will be described and at runtime MacRuby will appropriately use the right method encoding in case the selector matches.

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

Reply via email to