• 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: [MyClass class] returning superclass's class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MyClass class] returning superclass's class


  • Subject: Re: [MyClass class] returning superclass's class
  • From: Ken Tozier <email@hidden>
  • Date: Thu, 20 Nov 2008 09:03:36 -0500


On Nov 20, 2008, at 8:43 AM, Ken Thomases wrote:

You keep mentioning [MyClass class], except that's not what you're calling. You're invoking -class (the instance method, rather than the class method, by the way) on some object. That object is not an instance of MyClass or, in the case of your actual code, KOptionString.

I do understand the difference between a + method and - method, but cut to many corners in the original question, which caused some confusion. Oops.

In other words, class methods are just methods. There's no special status regarding the class object to which you send them. There's no rule or convention that, because you send a message to MyClass and got an object back, that that object's class should be MyClass.


Let me ask you this: the return value from (random example) + [NSPropertyListSerialization dataFromPropertyList:format:errorDescription:] -- of what class should that be? When you understand that there's no expectation that it would be an instance of NSPropertyListSerialization, and you understand how that's parallel to the behavior of +[KOptionString whitespaceCharacterSet], then you'll see where you went wrong.

Excellent point. I hadn't thought of that.

- Ken

_______________________________________________

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


References: 
 >[MyClass class] returning superclass's class (From: Ken Tozier <email@hidden>)
 >Re: [MyClass class] returning superclass's class (From: Andy Lee <email@hidden>)
 >Re: [MyClass class] returning superclass's class (From: Ken Tozier <email@hidden>)
 >Re: [MyClass class] returning superclass's class (From: Alexander Spohr <email@hidden>)
 >Re: [MyClass class] returning superclass's class (From: Ken Tozier <email@hidden>)
 >Re: [MyClass class] returning superclass's class (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: InputManagers in Leopard
  • Next by Date: Re: How to get notification of rerun application
  • Previous by thread: Re: [MyClass class] returning superclass's class
  • Next by thread: editWithFrame:inView:editor:delegate:event: in mouseDown:
  • Index(es):
    • Date
    • Thread