Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-17 Thread Sean McBride
On Tue, 17 Apr 2012 10:10:44 +1000, Graham Cox said: >Memory management is really quite straightforward I know what you mean, and agree that at its core ref counting is straightforward. But in practice Cocoa memory management is not so simple. Just look at this beast:

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-17 Thread Charles Srstka
On Apr 17, 2012, at 12:28 AM, Graham Cox wrote: > Well, I don't find ARC to be necessary. I tend to assume it was added to > counter the argument from developers coming from other languages to iOS that > Objective-C is "old fashioned" and requires too much hand-holding on the MM > front that th

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-17 Thread Jayson Adams
On Apr 17, 2012, at 1:28 AM, Graham Cox wrote: > …having been using Objective C productively for over 10 years now, that I > still find ARC something I have not needed. So far. I'm kinda hoping that > remains true, because it actually seems pretty complicated in order to cover > all the arcan

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-17 Thread Patrick Robertson
> While you have had the question answered, the fact you asked it shows a misunderstanding about memory management. Next time in my reply I will be clear to state that a) I have realised my mistake b) I have learnt from it to to save you some time writing your response ;-) I do appreciate your hel

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-17 Thread Graham Cox
On 17/04/2012, at 4:08 PM, Dave Zarzycki wrote: > ARC simply automates and enforces Cocoa conventions. No more, no less. > Therefore those "arcane use-cases" are in fact where programmers get > themselves into really subtle trouble with manual reference counting. Notwithstanding that programm

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-16 Thread Dave Zarzycki
On Apr 17, 2012, at 1:28 AM, Graham Cox wrote: > …having been using Objective C productively for over 10 years now, that I > still find ARC something I have not needed. So far. I'm kinda hoping that > remains true, because it actually seems pretty complicated in order to cover > all the arcane

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-16 Thread Graham Cox
On 17/04/2012, at 12:47 PM, Dave Zarzycki wrote: > On Apr 16, 2012, at 8:10 PM, Graham Cox wrote: > >> Memory management is really quite straightforward, and consists of a few >> rules that everything follows (the framework invariably does; your code >> should do). > > > If that were true,

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-16 Thread Dave Zarzycki
On Apr 16, 2012, at 8:10 PM, Graham Cox wrote: > Memory management is really quite straightforward, and consists of a few > rules that everything follows (the framework invariably does; your code > should do). If that were true, then ARC would not have been necessary. > On 16/04/2012, at 7:4

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-16 Thread Graham Cox
While you have had the question answered, the fact you asked it shows a misunderstanding about memory management. How fast enumeration is implemented should not make any difference to you, as its user. If it did create temporary objects then it would be responsible for clearing them up. (But th

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-16 Thread Patrick Robertson
> [ array objectAtIndex:i ] doesn't create temporaries either. OK, then that blew my logic right out of the water! Thanks for clearing things up Roland :) On 16 April 2012 10:53, Roland King wrote: > There are no temporary objects created during fast enumeration, you just > get a reference to

Re: Fast Enumeration and temporary objects/autoreleasing

2012-04-16 Thread Roland King
There are no temporary objects created during fast enumeration, you just get a reference to one of the objects in the thing you are enumerating. [ array objectAtIndex:i ] doesn't create temporaries either. On Apr 16, 2012, at 5:42 PM, Patrick Robertson wrote: > Hi all, > > I've searched the

Fast Enumeration and temporary objects/autoreleasing

2012-04-16 Thread Patrick Robertson
Hi all, I've searched the web, but can't seem to find any concrete information on how fast enumeration loops manage temporarily created objects. Would anybody be able to shine some light on whether fast enumeration itself takes care of the objects it creates? So, for example in: for (id anObject