Re: Is "-init" really needed?
Re: Is "-init" really needed?
- Subject: Re: Is "-init" really needed?
- From: email@hidden
- Date: Thu, 10 Aug 2017 08:57:39 -0500
> On Aug 10, 2017, at 02:18, Alastair Houghton <email@hidden>
> wrote:
>
> Personally I *would* still discourage +new in favour of class-specific
> convenience constructors because I think it’s less expressive and also less
> consistent (e.g. +array is better, in my opinion, than +new, not least
> because +arrayWithObjects: and others exist).
[NSArray new] := [[NSArray alloc]init]
[NSArray array] := [[[NSArray alloc]init]autorelease]
+array and friends came along with the introduction of autorelease pools, to
replace +new with something that didn't imply ownership (the oft mentioned
special meaning of "new" as prefix). So while with ARC they are essentially
equivalent, previously they were not.
Gerd
_______________________________________________
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