• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to check if super exists if it doesn't without throwing an exception?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to check if super exists if it doesn't without throwing an exception?


  • Subject: Re: How to check if super exists if it doesn't without throwing an exception?
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 18 Jun 2015 13:13:35 -0700

> On Jun 18, 2015, at 1:06 PM, Alex Zavatone <email@hidden> wrote:
>
> I've got some spooky code that I'm digging into that calls an instance method in an uninstantiated timer class

I’m not clear on what that means. If the class doesn’t have any instances, how are you calling an instance method on it?

> Within this pearl, we have [super sendevent:event]; within an @try block.
> At the point of the exception, super isn't even accessible, declared or defined.

‘super’ isn’t an object. It’s a language keyword that’s used as the receiver of a method call (message-send). It just means to call the superclass’s implementation of the method, or more literally, “send this message to self but ignore any implementation in self’s class, instead starting lookup in the superclass.”

If [super sendEvent:event] throws an exception, it means that the superclass does not have a -sendEvent: method.

—Jens
_______________________________________________

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


  • Follow-Ups:
    • Re: How to check if super exists if it doesn't without throwing an exception?
      • From: Alex Zavatone <email@hidden>
References: 
 >How to check if super exists if it doesn't without throwing an exception? (From: Alex Zavatone <email@hidden>)

  • Prev by Date: How to check if super exists if it doesn't without throwing an exception?
  • Next by Date: Re: How to check if super exists if it doesn't without throwing an exception?
  • Previous by thread: How to check if super exists if it doesn't without throwing an exception?
  • Next by thread: Re: How to check if super exists if it doesn't without throwing an exception?
  • Index(es):
    • Date
    • Thread