Zones, [[alloc] init], and all the new + methods
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]