Re: Mutability
Re: Mutability
- Subject: Re: Mutability
- From: Raphael Sebbe <email@hidden>
- Date: Wed, 21 Nov 2001 07:54:02 +0100
I would say that if it is your intent to add objects later in the
hierarchy, then use only mutable classes from the ground up. This will
make it a lot easier...
Raphael
On Wednesday, November 21, 2001, at 05:43 AM, Angela Brett wrote:
That's true, but consider the case where the object is deep in nested
NSArrays or NSDictionaries. Assuming the object is immutable means you
have to add the mutableCopy of it to its parent array/dictionary in
place of the original object, and if you don't know whether the parent
is mutable or not you'll also have to make a mutableCopy of that and
add it to its parent, and so on until you get to the 'root' object.
That's quite a lot of unnecessary steps if the original objects were
actually mutable anyway and you didn't know it. Or perhaps this post is
all newbie nonsense. :)