signatureWithObjCTypes: Is Still Private?!
I was looking into using NSProxy to do some fun transparent method invocations to an unnamed remote web service, and I noticed that because NSProxy subclasses require you to override methodSignatureForSelector: and forwardInvocation: (and you can’t reasonably implement the latter without having implemented the former). But because there’s no public way to create a NSMethodSignature other than from another Objective-C object (i.e., some other object’s methodSignatureForSelector:), or to create a NSInvocation from a method signature, this limits NSProxy’s usefulness in this particular context.
Long ago I did a CORBA ORB in Objective-C, and in order to make using the thing a little more painless, I subclassed NSProxy to provide Distributed Objects-style transparent messaging. But to get that going, I had to use a private NSMethodSignature method, signatureWithObjCTypes:. I think that was about six years ago, and I just checked, and sure enough, it’s still private and still has the same signature. I wonder: why? It’s not as though knowledge of the Objective-C runtime’s type encoding system is terribly uncommon, but it is one of those things that’s a little messy, and perhaps Apple wants to hide from the programmer.
This is the kind of thing that people are doing in Python now all the time; it would be grand if we could do this in Objective-C without having to resort to private methods. Apparently I’m not the first to gripe about this, either: more complaints here.
About this entry
You’re currently reading “ signatureWithObjCTypes: Is Still Private?! ,” an entry on stuffonfire.com
- Published:
- 12.23.05 / 5pm
- Category:
- Programming
1 Comment
Jump to comment form | comments rss [?]