Re: Retain/Release and Properties clarification

2011-10-14 Thread Bayes Scott F
Agreed. I just meant in the general case. ScottB On Oct 13, 2011, at 11:30 , David Rowland wrote: > However, if the property is readonly I think you must use direct access to > set an initial value. The setter does not exist. > > > David Rowland > > On Oct 13, 2011, at 10:54 AM, Bayes Scot

Re: Retain/Release and Properties clarification

2011-10-13 Thread David Rowland
However, if the property is readonly I think you must use direct access to set an initial value. The setter does not exist. David Rowland On Oct 13, 2011, at 10:54 AM, Bayes Scott F wrote: > Thank you, David. > > Sounds like safety first for my code: always use the setter/getter for > synthe

Re: Retain/Release and Properties clarification

2011-10-13 Thread Bayes Scott F
Thank you, David. Sounds like safety first for my code: always use the setter/getter for synthesized properties, even in self. Or use ivars. ScottB On Oct 12, 2011, at 09:21 , Bayes Scott F wrote: > Someone on Matt's site mentioned the possibility that the synthesized ivar > could be impleme

Re: Retain/Release and Properties clarification

2011-10-12 Thread Bayes Scott F
Thanks, Greg. ScottB On Oct 12, 2011, at 12:12 , Greg Parker wrote: > On Oct 12, 2011, at 9:21 AM, Bayes Scott F wrote: >> Someone on Matt's site mentioned the possibility that the synthesized ivar >> could be implemented indirectly, say as a member of a collection. Since the >> implementatio

Re: Retain/Release and Properties clarification

2011-10-12 Thread Greg Parker
On Oct 12, 2011, at 9:21 AM, Bayes Scott F wrote: > Someone on Matt's site mentioned the possibility that the synthesized ivar > could be implemented indirectly, say as a member of a collection. Since the > implementation's opaque, we don't know if that ever can happen. A property may be impleme

Re: Retain/Release and Properties clarification

2011-10-12 Thread Bayes Scott F
Thank you, David, that's pretty clear. Sounds like safety first for my code: always use the setter/getter for synthesized properties, even in self. Or use @private ivars. ScottB On Oct 12, 2011, at 09:46 , David Duncan wrote: > On Oct 12, 2011, at 9:21 AM, Bayes Scott F wrote: > >> Someone o

Re: Retain/Release and Properties clarification

2011-10-12 Thread David Duncan
On Oct 12, 2011, at 9:21 AM, Bayes Scott F wrote: > Someone on Matt's site mentioned the possibility that the synthesized ivar > could be implemented indirectly, say as a member of a collection. Since the > implementation's opaque, we don't know if that ever can happen. I can't say that I know

Re: Retain/Release and Properties clarification

2011-10-12 Thread Bayes Scott F
Someone on Matt's site mentioned the possibility that the synthesized ivar could be implemented indirectly, say as a member of a collection. Since the implementation's opaque, we don't know if that ever can happen. So, is self->mySynthIvar safe (both lvalue and rvalue), or should we be messagin

Re: Retain/Release and Properties clarification

2011-10-11 Thread David Duncan
On Oct 11, 2011, at 9:57 AM, Matt Neuburg wrote: > I did everything "right" when I named an ivar "firstResponder" (property, > synthesized ivar, synthesized accessors) and totally broke my app because > Apple was apparently already using an undocumented ivar called > "firstResponder". > > http

Re: Retain/Release and Properties clarification

2011-10-11 Thread Matt Neuburg
On Fri, 07 Oct 2011 19:46:17 -0400, Andy Lee said: >On Oct 3, 2011, at 2:23 PM, Charles Srstka wrote: >> 2. KVO’s “access instance variables directly” (mis)feature recognizes the >> underscore prefix. I like to give it a prefix that KVO doesn’t know about so >> that I can be sure never to end up

Re: Retain/Release and Properties clarification

2011-10-07 Thread Andy Lee
On Oct 3, 2011, at 2:23 PM, Charles Srstka wrote: > 2. KVO’s “access instance variables directly” (mis)feature recognizes the > underscore prefix. I like to give it a prefix that KVO doesn’t know about so > that I can be sure never to end up accidentally accessing the ivars of > another object w

Re: Retain/Release and Properties clarification

2011-10-07 Thread Charles Srstka
On Oct 7, 2011, at 11:40 AM, Sean McBride wrote: > On Mon, 3 Oct 2011 13:23:25 -0500, Charles Srstka said: > >> 1. Apple reserves the underscore prefix for their own use, so you could, >> at least theoretically, clash with a superclass ivar this way, and > > In addition to what Kyle replied, I'd

Re: Retain/Release and Properties clarification

2011-10-07 Thread Sean McBride
On Fri, 7 Oct 2011 10:21:41 -0700, Glenn L. Austin said: >Do I really need to quote the C and C++ standards that states that a >leading underscore on a symbol is reserved to the implementation -- in >other words 'the implementation' is everything that you're not writing? ISO/IEC 9899:1999, Sectio

Re: Retain/Release and Properties clarification

2011-10-07 Thread Glenn L. Austin
On Oct 7, 2011, at 9:40 AM, Sean McBride wrote: > On Mon, 3 Oct 2011 13:23:25 -0500, Charles Srstka said: > >> 1. Apple reserves the underscore prefix for their own use, so you could, >> at least theoretically, clash with a superclass ivar this way, and > > In addition to what Kyle replied, I'd

Re: Retain/Release and Properties clarification

2011-10-07 Thread Wade Tregaskis
> In addition to what Kyle replied, I'd just like to point out that prefixing > your *methods* with an underscore is a very bad idea, since Apple does > reserve such names and a conflict will bite you at runtime possibly affecting > the binary compatibility of your app. I would argue that under

Re: Retain/Release and Properties clarification

2011-10-07 Thread Sean McBride
On Mon, 3 Oct 2011 13:23:25 -0500, Charles Srstka said: >1. Apple reserves the underscore prefix for their own use, so you could, >at least theoretically, clash with a superclass ivar this way, and In addition to what Kyle replied, I'd just like to point out that prefixing your *methods* with an

Re: Retain/Release and Properties clarification

2011-10-03 Thread John Tsombakos
On Mon, Oct 3, 2011 at 2:01 PM, Andreas Mayer wrote: > > Am 03.10.2011 um 16:14 schrieb John Tsombakos: > >> audioPlayer = [self getSoundFile:"soundfile.wav"]; >> ... >> >> in getSoundFile routine: >> AVAudioPlayer *snd; >> ... >> snd = [[[AVAudioPlayer alloc] initWithContentsOfURL:url error:&erro

Re: Retain/Release and Properties clarification

2011-10-03 Thread Charles Srstka
On Oct 3, 2011, at 1:31 PM, Kyle Sluder wrote: >> 1. Apple reserves the underscore prefix for their own use, so you could, at >> least theoretically, clash with a superclass ivar this way, and > > [snip] > >> >> 3. If I use an ivar prefix that no one else uses (as far as I know), then I >> ca

Re: Retain/Release and Properties clarification

2011-10-03 Thread Kyle Sluder
On Mon, Oct 3, 2011 at 11:23 AM, Charles Srstka wrote: > 1. Apple reserves the underscore prefix for their own use, so you could, at > least theoretically, clash with a superclass ivar this way, and [snip] > > 3. If I use an ivar prefix that no one else uses (as far as I know), then I > can ma

Re: Retain/Release and Properties clarification

2011-10-03 Thread Charles Srstka
On Oct 3, 2011, at 10:14 AM, John Tsombakos wrote: > (and will also change to use the underscore ivar names too - I had done that > previously, but...well, didn't this time.) I recommend using some other prefix system instead of the underscore, for two reasons: 1. Apple reserves the underscore

Re: Retain/Release and Properties clarification

2011-10-03 Thread Andreas Mayer
Am 03.10.2011 um 16:14 schrieb John Tsombakos: > audioPlayer = [self getSoundFile:"soundfile.wav"]; > ... > > in getSoundFile routine: > AVAudioPlayer *snd; > ... > snd = [[[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error] The question was already answered, but I wanted to point out

Re: Retain/Release and Properties clarification

2011-10-03 Thread John Tsombakos
On Mon, Oct 3, 2011 at 10:29 AM, Steve Sisak wrote: >> At 10:14 AM -0400 10/3/11, John Tsombakos wrote: >> @interface AudioPlayerViewController : UIViewController { >> AVAudioPlayer *audioPlayer; >> } >> @property (retain) AVAudioPlayer *audioPlayer; >> >> In the .m file: >> @synthesize audioPlaye

Re: Retain/Release and Properties clarification

2011-10-03 Thread Eeyore
Not enough morning coffee for you, On Oct 3, 2011, at 7:29 AM, Steve Sisak wrote: > You do, indeed want: > > self.audioPlayer = [self getSoundFile:"soundfile.wav"]; > > or > > [self setAudioPlayer = [self getSoundFile:"soundfile.wav"]]; I think you meant [self setAudioPlayer:[self getSoundFil

Re: Retain/Release and Properties clarification

2011-10-03 Thread Steve Sisak
At 10:14 AM -0400 10/3/11, John Tsombakos wrote: @interface AudioPlayerViewController : UIViewController { AVAudioPlayer *audioPlayer; } @property (retain) AVAudioPlayer *audioPlayer; In the .m file: @synthesize audioPlayer; in viewDidLoad: audioPlayer = [self getSoundFile:"soundfile.wav"]; You