On Jan 9, 2010, at 8:40 PM, Dave Keck wrote:

>> Discussion
>> This method is a combination of alloc and init. Like alloc, it initializes 
>> the isa instance variable of the new object so it points to the class data 
>> structure. It then invokes the init method to complete the initialization 
>> process.
> 
> While we're on the topic, I always thought +new would be much more
> useful if it did autorelease the result, making it inline with class
> convenience constructors. Any specific reason why this isn't so?

Probably historical.  I believe +new dates back to NextStep, before there was 
retain and release.

You could always add your own method in a category of NSObject.  Not sure what 
to call it -- maybe +instantiate?  The nice thing about using a sensible name 
is that it's sensible, but it runs the risk of collision if Apple ever decides 
to add a method with the same sensible name.

--Andy


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to