• 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: [Foo new] vs [[Foo alloc] init]:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Foo new] vs [[Foo alloc] init]:


  • Subject: Re: [Foo new] vs [[Foo alloc] init]:
  • From: Bill Bumgarner <email@hidden>
  • Date: Sun, 17 Feb 2008 15:05:27 -0800

On Feb 17, 2008, at 2:28 PM, Gregory Weston wrote:
Or you could just not assume that something which hasn't been explicitly stated in the docs is guaranteed. That's what I've been trying to say: The only promise the documentation makes about new, alloc and allocWithZone is that they're peers. It doesn't say a peep about any of them invoking any of the others to achieve that equivalence. That lack of explicit promise - the utter inability to make such a promise in general - is why it's wrong to say without a whole lot of caveats that one technique is precisely equivalent to another. Looking at the implementation of a method, rather than the interface, as it exists today and saying "you can count on this" is an outright rejection of one of the core concepts of OO.

You can draw that conclusion if you want.

In light of the documentation, the binary compatibility requirements, and the implementation for at least the past 6 years -- if not the past 14 -- it would seem a rather pessimistic conclusion.

+alloc is a cover for +allocWithZone: with a NULL zone. Not that you would know that from the documentation, unfortunately.

Which means, like the current behavior of new, that's an implementation detail that shouldn't really be relied on.

Hardly the point. If you are overriding +alloc for whatever reason, you better had override +allocWithZone:, too.


b.bum
_______________________________________________

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: [Foo new] vs [[Foo alloc] init]:
      • From: Gregory Weston <email@hidden>
References: 
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Gregory Weston <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Bill Bumgarner <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Gregory Weston <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Bill Bumgarner <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Gregory Weston <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Bill Bumgarner <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Gregory Weston <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Bill Bumgarner <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Gregory Weston <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Bill Bumgarner <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Gregory Weston <email@hidden>)

  • Prev by Date: Best way to replace one view with another within a superview
  • Next by Date: Re: @property problem
  • Previous by thread: Re: [Foo new] vs [[Foo alloc] init]:
  • Next by thread: Re: [Foo new] vs [[Foo alloc] init]:
  • Index(es):
    • Date
    • Thread