• 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
Zones, [[alloc] init], and all the new + methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Zones, [[alloc] init], and all the new + methods


  • Subject: Zones, [[alloc] init], and all the new + methods
  • From: "Simson Garfinkel" <email@hidden>
  • Date: Wed, 26 Dec 2001 12:06:57 -0500

I've noticed that Apple is now shying away from [[<CLASS> alloc] init]
and has instead created a whole bunch of [<CLASS> <class>] constructors.

For example, instead of using

id dict = [[NSMutableDictionary alloc] init];

to create a dictionary, the correct approach is now:

id dict = [NSMutableDictionary dictionary];

Similarly, instead of

id path = [[NSBezierPath alloc] init]

We are now to use:

id path = [NSBezierPath bezierPath];

Can anyone share with me the logic for this?

One of the big advantage of the [[<class> alloc] init] approach
is that it very easily became [[<class> allocFromZone:myZone] init]


  • Follow-Ups:
    • Re: Zones, [[alloc] init], and all the new + methods
      • From: "John C. Randolph" <email@hidden>
    • Re: Zones, [[alloc] init], and all the new + methods
      • From: Thomas Lachand-Robert <email@hidden>
  • Prev by Date: Re: Getting the original moviebox in Cocoa
  • Next by Date: NSFont and the Carbon Font Manager
  • Previous by thread: Re: multiple targets/selectors
  • Next by thread: Re: Zones, [[alloc] init], and all the new + methods
  • Index(es):
    • Date
    • Thread