On Mon, Dec 22, 2008 at 4:30 PM, WT <jrca...@gmail.com> wrote: > One is not obligated to use NSProxy to implement the Proxy pattern. I must > admit not being all that familiar with NSProxy, but having the proxy and the > object it stands for share the same public API (by being instances of > subclasses of the same abstract class) seems to me to be a good thing since > the object and its proxy can be transparently swapped in code. If I > understand NSProxy correctly, you lose that transparency when you use it, > because NSProxy and NSObject are in different inheritance trees.
In objective-c any object instance "could" stand in for any other object as long as it supported the set of messages that would be sent to it at runtime. No inheritance is needed in this regard. Also objective-c supports protocols (much like interfaces in Java) that classes can state they implement ("conforms to"). This allows disjoint class hierarchies to support the same set of messages with compile time verification. An NSProxy sub-class (NSObject for that matter) could be used as a stand in for any other object instance by leveraging forward invocation, etc. NSProxy does implement the NSObject protocol so it it known to act as an NSObject at its core behavior. -Shawn _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com