Re: Using performSelector: on super
Re: Using performSelector: on super
- Subject: Re: Using performSelector: on super
- From: James Bucanek <email@hidden>
- Date: Tue, 5 Aug 2008 13:31:56 -0700
Shawn Erickson <mailto:email@hidden> wrote (Tuesday, August
5, 2008 12:38 PM -0700):
On Tue, Aug 5, 2008 at 12:18 PM, James Bucanek <email@hidden> wrote:
email@hidden <mailto:email@hidden> wrote (Tuesday,
August 5, 2008 5:41 AM +0100):
My superclass (SuperSocket) provides a private method -close.
Others have adiquetly explained the whole 'self' vs. 'super' issue, but this
statement still has me stumped and I'm wondering why this even came up.
There is no such thing as a "private" method in Objective-C. The @private,
@protected, @public keywords only work on instance variables. So if the
super class implements -close, there should never be anything stopping your
subclass from simply calling [super close].
True however...
<clip>
and at worst the
compiler could emit a call chain that incorrectly passes parameters
and/or fetches the return value as result of incorrect assumptions
about parameter/return types (should see a warning as well).
I don't see how that is possible. The only difference between
[self method] and [super method] is the former calls
objc_msgSend and the later calls objc_msgSendSuper. In the OP's
situation, the methods must have the same prototype and the
determination of what -close method is implemented by the
superclass is done at runtime by objc_msgSendSuper. So there
aren't any compiler assumptions that could influence this
(beyond the compiler complaining that it doesn't think that the
superclass actually implements the method).
--
James Bucanek
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden