Re: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Jens Alfke
On Oct 9, 2009, at 2:30 AM, Graham Cox wrote: In init and dealloc, it is usual & recommended to access the ivar directly - not because self isn't defined (it is), but because at those times you are usually only concerned with setting the ivar's initial value (possibly to an object), or rel

Re: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Matthias Arndt
Am 09.10.2009 um 13:32 schrieb Graham Cox : In the first case, interested observers using KVO to track changes to will get automatically notified, and any subclasses that have overridden -setIvar: or -ivar also get called as they should. Got it :-) As always your feedback is simply pricel

Re: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Graham Cox
On 09/10/2009, at 10:14 PM, Matthias Arndt wrote: [self setIvar:[self ivar] + 1]; instead of iVar++; looks a bit confusing to me. Maybe confusing, but the two are not necessarily equivalent. In the second case, you are merely incrementing the ivar. No-one else would know anythin

Re: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Matthias Arndt
Am 09.10.2009 um 11:30 schrieb Graham Cox: In init and dealloc, it is usual & recommended to access the ivar directly - not because self isn't defined (it is), but because at those times you are usually only concerned with setting the ivar's initial value (possibly to an object), or releasi

Re: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Graham Cox
On 09/10/2009, at 8:01 PM, Matthias Arndt wrote: While restructuring some old classes I'm uncertain about the preferred way to access instance variables within their own instance: I tend to defines all these variables as properties and use their implicit getters / setters, but ... 1. ) .

Instance variables: access directly vs. getter / setter

2009-10-09 Thread Matthias Arndt
While restructuring some old classes I'm uncertain about the preferred way to access instance variables within their own instance: I tend to defines all these variables as properties and use their implicit getters / setters, but ... 1. ) ... in the designated initializer I have to access th