Re: Properties vs Instance Variables

2011-05-13 Thread William Squires
On Apr 26, 2011, at 10:28 PM, Guy Steven wrote: > I am currently learning objective c and cocoa > > I believe I understand the difference between properties and instance > variables, and the effect of using properties as opposed to instance > variables viz a viz KVO and memory management. > > W

Re: Properties vs Instance Variables

2011-04-27 Thread Joanna Carter
Le 27 avr. 2011 à 17:39, David Duncan a écrit : > @property(...) id foo; > @synthesize foo = _foo; > > Then the following holds: > _foo and self->_foo are equivalent means of direct ivar access. > self.foo = bar and [self setFoo:bar] are equivalent means of setting the > value of the property fo

Re: Properties vs Instance Variables

2011-04-27 Thread David Duncan
On Apr 27, 2011, at 9:09 AM, Joanna Carter wrote: > I too would like to see a means of explicitly accessing the ivar, even if it > has the same name as the property; although, I thought that not calling > self.property from within the .m file defaulted to accessing the ivar if both > it and a p

Re: Properties vs Instance Variables

2011-04-27 Thread Joanna Carter
Le 27 avr. 2011 à 16:52, Matt Neuburg a écrit : > And Apple now exemplifies this pattern, e.g. in the app template for > Window-based Application: there's a "window" property accessing a "_window" > ivar. I think they do this just so you can't accidentally say "window" > unqualified. m. I also

Re: Properties vs Instance Variables

2011-04-27 Thread Matt Neuburg
On Tue, 26 Apr 2011 21:23:10 -0700, Kyle Sluder said: >On Tue, Apr 26, 2011 at 9:07 PM, Steve Christensen wrote: >> I believe it's only necessary if you want to do a straight "@synthesize >> foo;", which would expect the instance variable to have the same name as the >> property. > >And it's wo

Re: Properties vs Instance Variables

2011-04-26 Thread Quincey Morris
On Apr 26, 2011, at 20:28, Guy Steven wrote: > I believe I understand the difference between properties and instance > variables, and the effect of using properties as opposed to instance > variables viz a viz KVO and memory management. > > What I can't understand is why you would access instance

Re: Properties vs Instance Variables

2011-04-26 Thread Kyle Sluder
On Tue, Apr 26, 2011 at 9:07 PM, Steve Christensen wrote: > I believe it's only necessary if you want to do a straight "@synthesize > foo;", which would expect the instance variable to have the same name as the > property. And it's worth mentioning that you can always do @synthesize foo=_foo; t

Re: Properties vs Instance Variables

2011-04-26 Thread Steve Christensen
On Apr 26, 2011, at 8:28 PM, Guy Steven wrote: > I am currently learning objective c and cocoa > > I believe I understand the difference between properties and instance > variables, and the effect of using properties as opposed to instance > variables viz a viz KVO and memory management. A prope

Re: Properties vs Instance Variables

2011-04-26 Thread Rick Mann
Speed is generally not something to be concerned about WRT property accessors. If you want to bypass the property accessor behavior when accessing an ivar, then access it directly. Somewhere in Apple's docs I read a suggestion that IBOutlets be released in -dealloc by direct access, and release

Properties vs Instance Variables

2011-04-26 Thread Guy Steven
I am currently learning objective c and cocoa I believe I understand the difference between properties and instance variables, and the effect of using properties as opposed to instance variables viz a viz KVO and memory management. What I can't understand is why you would access instance variable