[Pyobjc-dev] Quick summary of Perl bridges
Brought to you by:
ronaldoussoren
From: <bb...@ma...> - 2002-11-25 15:49:40
|
On Monday, November 25, 2002, at 05:54 AM, Peter Montagner wrote: > On another note, has anyone here looked at CamelBones? I'm not really > a Perl person but has anyone looked at how it does the Perl-ObjC > bridge? Could be interesting. The author of CamelBones and I exchanged a few messages a bit ago. CamelBones doesn't currently do subclassing. It hopefully will in the next version, but that won't be due out for a while. The author sends his thanks-- he has been using the PyObjC module's source to solve some of the issues he has faces. According to... man PerlObjCBridge ... the PerlObjC bridge is bidirectional but does not yet support subclassing(?) ... Objective-C objects from Perl programs, allowing Cocoa objects in Apple Computer's Mac OS X to be directly manip- ulated from Perl. In addition, Perl objects can be mes- saged from Objective-C, making it possible for Perl objects to function as Cocoa delegates and as targets of notifications and other Cocoa call-back messages. Perl programs can take advantage of Cocoa's Distributed Objects mechanism to support messaging between Perl objects and Objective-C objects (or other Perl objects) in different address spaces, possibly on different machines. It also uses the same name mangling as pyobjc. Clearly, the author had some challenges in wrapping the NSProxy class [perfectly understandable] because the man page has a huge section on using the PerlObjC bridge with DO -- something that should "just work" once the bridge is working correctly. This is interesting... When an Objective-C method declares a signed char or signed short argument, if a negative value is passed the actual value received by the method is coerced to an unsigned char or unsigned short, respectively. For exam- ple, if a method declares a signed char argument and -100 is passed the actual value received by the method will be 156. This is due to bug 2545453 in the Foundation frame- work. ... either the bug is fixed or our implementation doesn't suffer from it: >>> from Foundation import NSNumber >>> x = NSNumber.numberWithShort_(-100) >>> x -100 >>> x.intValue() + 2 -98 The PerlObjC bridge does not support all of the various #defines, typedef enums, and C Functions found in the Foundation or AppKit. The author indicates that support is left to the developer. |