• 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: Class vs +class: Cocoa/Obj-C design question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class vs +class: Cocoa/Obj-C design question


  • Subject: Re: Class vs +class: Cocoa/Obj-C design question
  • From: Chris Ryland <email@hidden>
  • Date: Tue, 16 Oct 2007 19:34:12 -0400

On Oct 16, 2007, at 10:31 AM, Bill Bumgarner wrote:

On Oct 16, 2007, at 12:19 AM, Chris Suter wrote:
So, going back to the original question, is there a circumstance where NSObject isn't the same as [NSObject class]?

Effectively, they are the same thing.

Technically, they are never the same. Bare "NSObject" can only be used for invoking class methods. [NSObject class] produces a pointer to the class that can be used for messaging, comparison, etc...

OK, thanks for explaining.

Seems to me that the real issue here is that NSObject is just a typename in C, and not a pointer to the class, while the [NSObject ...] construct is defined to use any initial typename as a class object to which a method is sent.

I'm noodling on the design of a fully dynamic Objective-C-like language for Cocoa where the simple name NSObject evaluates to a full- fledged object (no more C pointers in this language except at language-crossing boundaries), so in that case I could assert that NSObject === [NSObject class] === [NSObject self], both technically and effectively.

But I sure wish [NSObject class] was defined to be the metaclass, and [NSObject self] were defined to be the class itself (to get around the C language limitation), as then when you're required to do metaclass munging, it all coheres.

Cheers!
--Chris Ryland / Em Software, Inc. / www.emsoftware.com

_______________________________________________

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: 
 >Class vs +class: Cocoa/Obj-C design question (From: Chris Ryland <email@hidden>)
 >Re: Class vs +class: Cocoa/Obj-C design question (From: Bill Bumgarner <email@hidden>)
 >Re: Class vs +class: Cocoa/Obj-C design question (From: Chris Ryland <email@hidden>)
 >Re: Class vs +class: Cocoa/Obj-C design question (From: Bill Bumgarner <email@hidden>)
 >Re: Class vs +class: Cocoa/Obj-C design question (From: Chris Suter <email@hidden>)
 >Re: Class vs +class: Cocoa/Obj-C design question (From: Bill Bumgarner <email@hidden>)
 >Re: Class vs +class: Cocoa/Obj-C design question (From: Chris Suter <email@hidden>)
 >Re: Class vs +class: Cocoa/Obj-C design question (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: Validation error in a relationship? (in coredata)
  • Next by Date: Re: Validation error in a relationship? (in coredata)
  • Previous by thread: Re: Class vs +class: Cocoa/Obj-C design question
  • Next by thread: NSOpenPanel not showing all Folders in the Left Pane
  • Index(es):
    • Date
    • Thread