On Aug 19, 2016, at 12:33 , [email protected] wrote:
> 
>> AFAICT, the main reason *not* to use ‘new’ is to avoid generating anxiety 
>> for those who come back to read the code later, and who might worry that the 
>> inconsistency means something.
> 
> Even though new has been a synonym for alloc] init] for decades.

I really just meant anxiety about one app using two different patterns for the 
same thing. Same thing if the app used “new” in some places and “alloc/init” in 
others.


On Aug 19, 2016, at 10:53 , Charles Srstka <[email protected]> wrote:
> 
> [NSArray array] is a synonym for [[[NSArray alloc] init] autorelease].

(along with other similar comments in other responses)

To be pedantic, it’s *implemented* as [[[NSArray alloc] init] autorelease], but 
the lack of an API contract to that effect means that “synonym” isn’t quite 
accurate.

My point is that Apple might revisit the implementation of NSArray at any time 
(in these Swiftian days, stranger things have happened), and choose to write it 
with full ARC compatibility, which means there might not be any autorelease 
when invoked from ARC client code, since ARC can optimize the code when it 
handles both ends of the invocation.

_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to