Re: What, exactly constitutes a mutable action on an instance?

2013-05-29 Thread Diederik Meijer | Ten Horses
May I add two questions to this enlightening thread? 1. With ARC, do we still have to worry about string1 leaking in the following scenario? @property (nonatomic, copy) NSString *string1; ….. self.string1 = @Hello; string1 = @Hello hello; string1 = @Hello hello hello; 2. How do the strong,

Re: What, exactly constitutes a mutable action on an instance?

2013-05-29 Thread Robert Vojta
On Wednesday, 29. May 2013 at 8:37, Diederik Meijer | Ten Horses wrote: May I add two questions to this enlightening thread? 1. With ARC, do we still have to worry about string1 leaking in the following scenario? @property (nonatomic, copy) NSString *string1; ….. No, ARC perfectly

Re: What, exactly constitutes a mutable action on an instance?

2013-05-29 Thread Quincey Morris
On May 28, 2013, at 23:37 , Diederik Meijer | Ten Horses diede...@tenhorses.com wrote: 1. With ARC, do we still have to worry about string1 leaking in the following scenario? @property (nonatomic, copy) NSString *string1; ….. self.string1 = @Hello; string1 = @Hello hello; string1 =

Re: What, exactly constitutes a mutable action on an instance?

2013-05-29 Thread Diederik Meijer | Ten Horses
Thanks Robert and Quincey, that's very helpful! Op May 29, 2013, om 8:26 AM heeft Quincey Morris quinceymor...@rivergatesoftware.com het volgende geschreven: On May 28, 2013, at 23:37 , Diederik Meijer | Ten Horses diede...@tenhorses.com wrote: 1. With ARC, do we still have to worry

What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Alex Zavatone
Though it's clearly defined in the docs when to use NSMubleAnything vs. NSAnything (insert Array, Dictionary, String, etc for Anything), there is no compiler warning when you perform a simple action such as allocate a string and then reassign values to it. With this in mind, what exactly

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Roland King
On 28 May, 2013, at 9:39 PM, Alex Zavatone z...@mac.com wrote: Though it's clearly defined in the docs when to use NSMubleAnything vs. NSAnything (insert Array, Dictionary, String, etc for Anything), there is no compiler warning when you perform a simple action such as allocate a string

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Alex Zavatone
On May 28, 2013, at 9:50 AM, Roland King wrote: On 28 May, 2013, at 9:39 PM, Alex Zavatone z...@mac.com wrote: Though it's clearly defined in the docs when to use NSMubleAnything vs. NSAnything (insert Array, Dictionary, String, etc for Anything), there is no compiler warning when you

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Steve Mills
On May 28, 2013, at 08:39:21, Alex Zavatone z...@mac.com wrote: Though it's clearly defined in the docs when to use NSMubleAnything vs. NSAnything (insert Array, Dictionary, String, etc for Anything), there is no compiler warning when you perform a simple action such as allocate a string

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Alex Zavatone
On May 28, 2013, at 9:46 AM, Steve Mills wrote: On May 28, 2013, at 08:39:21, Alex Zavatone z...@mac.com wrote: Though it's clearly defined in the docs when to use NSMubleAnything vs. NSAnything (insert Array, Dictionary, String, etc for Anything), there is no compiler warning when you

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Thomas Wetmore
Alex, What your three lines of code do: NSString *myString; Compiler allocates space for a pointer on the run time stack. myString = @Hi; Compiler creates an NSString object somewhere in the heap with the value @Hi and points the pointer to it. myString = @Hi there; Compiler creates

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Thomas Wetmore
Alex, Forget what I said about memory management. It is wrong. Your confusion probably stems from the fact that the pointer named myString is allowed to point to any number of string during the execution of your program. It is the objects that are immutable, not the pointers to them. Tom

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Lee Ann Rucker
On May 28, 2013, at 7:44 AM, Alex Zavatone wrote: On May 28, 2013, at 9:46 AM, Steve Mills wrote: On May 28, 2013, at 08:39:21, Alex Zavatone z...@mac.com wrote: Though it's clearly defined in the docs when to use NSMubleAnything vs. NSAnything (insert Array, Dictionary, String, etc

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Jens Alfke
On May 28, 2013, at 6:39 AM, Alex Zavatone z...@mac.com wrote: NSString *myString; You’ve declared myString as a _mutable_ pointer to an _immutable_ object. If you had declared it as NSString* const myString = @“Hi; then the variable itself would be immutable, and the compiler would