Re: ARC and autorelease pools

2014-02-17 Thread Marcel Weiher
On Feb 17, 2014, at 2:08 , Clark Smith Cox III clark@apple.com wrote: I didn't say take them out. I said why do they need to return an autoreleased object. Because they always have, and their semantics cannot be changed without breaking decades worth of non-ARC code. Sort of like

Re: ARC and autorelease pools

2014-02-17 Thread Kevin Meaney
Thanks to Marcel, John McCall, and Clark Smith Cox III for addressing the question I was trying to ask, apologies to others that the question was unclear. So it seems that because ARC provides compatibility between ARC and non-ARC code unlike how garbage collection worked with duplicated

ARC and autorelease pools

2014-02-16 Thread Kevin Meaney
need to put my own autorelease pool in place, something I wouldn't have to think about if it wasn't an autoreleased object. Documentation doesn't provide any information as to which methods return an autoreleased object or not. But since I can't call autorelease myself in ARC code if I have

Re: ARC and autorelease pools

2014-02-16 Thread Roland King
I can't call autorelease myself in ARC code if I have a method like. KMImage *bigImage = [image kmImageByDoublingSize]; I'm not returning an autoreleased object so there is a difference in behaviour between the behaviour of methods in apple frameworks and the ones outside of those

Re: ARC and autorelease pools

2014-02-16 Thread Charles Srstka
On Feb 16, 2014, at 7:27 AM, Kevin Meaney k...@yvs.eu.com wrote: Why do these methods need to return an autoreleased object, why can't they behave the same as: NSString *myString = [[NSString alloc] initWithFormat:@%@, @my String]; Is the only reason for interoperability with manual

Re: ARC and autorelease pools

2014-02-16 Thread Jens Alfke
On Feb 16, 2014, at 5:27 AM, Kevin Meaney k...@yvs.eu.com wrote: Is the only reason for interoperability with manual retain-release code? For backward compatibility. Nearly every piece of existing Cocoa code uses these methods, so there's no way they could take them out. It seems that it

Re: ARC and autorelease pools

2014-02-16 Thread Kevin Meaney
On 16 Feb 2014, at 17:06, Jens Alfke j...@mooseyard.com wrote: On Feb 16, 2014, at 5:27 AM, Kevin Meaney k...@yvs.eu.com wrote: Is the only reason for interoperability with manual retain-release code? For backward compatibility. Nearly every piece of existing Cocoa code uses these

Re: ARC and autorelease pools

2014-02-16 Thread Jens Alfke
On Feb 16, 2014, at 10:22 AM, Kevin Meaney k...@yvs.eu.com wrote: I didn't say take them out. I said why do they need to return an autoreleased object. Why can't they just return an object like alloc init... does. Because if they returned an object that wasn't autoreleased (i.e. that the

Re: ARC and autorelease pools

2014-02-16 Thread Jens Alfke
On Feb 16, 2014, at 10:22 AM, Kevin Meaney k...@yvs.eu.com wrote: You're missing the question I was trying to ask. Why is autorelease needed at all? It's needed when a method creates an object [or otherwise gets an object with a reference that needs to be released] and has to return that

Re: ARC and autorelease pools

2014-02-16 Thread Scott Ribe
And would be just like every other manual reference-counting scheme, with all of the additional code they entail, and the higher liklihood of bugs, and so on... On Feb 16, 2014, at 2:13 PM, Jens Alfke j...@mooseyard.com wrote: The only way to resolve this without autorelease would be to

Re: ARC and autorelease pools

2014-02-16 Thread John McCall
On Feb 16, 2014, at 1:03 PM, Jens Alfke j...@mooseyard.com wrote: On Feb 16, 2014, at 10:22 AM, Kevin Meaney k...@yvs.eu.com wrote: I didn't say take them out. I said why do they need to return an autoreleased object. Why can't they just return an object like alloc init... does. Because

Re: ARC and autorelease pools

2014-02-16 Thread Clark Smith Cox III
On Feb 16, 2014, at 10:22, Kevin Meaney k...@yvs.eu.com wrote: On 16 Feb 2014, at 17:06, Jens Alfke j...@mooseyard.com wrote: On Feb 16, 2014, at 5:27 AM, Kevin Meaney k...@yvs.eu.com wrote: Is the only reason for interoperability with manual retain-release code? For backward

Arc and autorelease

2012-05-24 Thread Gerriet M. Denkmann
Without Arc, this: NSString *s = [ [ NSString alloc ] initWithFormat: ...]; [ someCollection addObject: s ]; [ s release ]; is clearly more efficient (because not using autoreleasepools) than: NSString *s = [ NSString stringWithFormat: ...]; [ someCollection addObject: s ]; But what about Arc?

Re: Arc and autorelease

2012-05-24 Thread Ken Thomases
On May 24, 2012, at 3:14 AM, Gerriet M. Denkmann wrote: Without Arc, this: NSString *s = [ [ NSString alloc ] initWithFormat: ...]; [ someCollection addObject: s ]; [ s release ]; is clearly more efficient (because not using autoreleasepools) than: NSString *s = [ NSString

Re: Arc and autorelease

2012-05-24 Thread David Duncan
On May 24, 2012, at 1:14 AM, Gerriet M. Denkmann wrote: Without Arc, this: NSString *s = [ [ NSString alloc ] initWithFormat: ...]; [ someCollection addObject: s ]; [ s release ]; is clearly more efficient (because not using autoreleasepools) than: NSString *s = [ NSString