Re: From Panther to Tiger
Re: From Panther to Tiger
- Subject: Re: From Panther to Tiger
- From: Bob Ippolito <email@hidden>
- Date: Mon, 16 May 2005 16:25:09 -0400
On May 16, 2005, at 4:12 PM, Ondra Cada wrote:
On 16.5.2005, at 21:54, Bob Ippolito wrote:
Well, does it REALLY surprise you that when you ask an immutable
container class to load itself from disk, you will get an
immutable container back?
Nope, that's not the problem. The problem is that the *contained*
object mutability gets lost in the process!
Does it, to paraphrase your very own words, NOT surprise you the
following simple sample raises? Me, I was surprised all right. In
my vocabulary, this is *WRONG*. But I've kind of got used to that
with CoreData-based stuff :(((
No, it is NOT wrong, but your examples sure were :)
Property lists (in their entirety, not just the root object!) are not
inherently mutable or immutable, the method you use to deserialize
them has always determined whether they should be and contain mutable
objects.
It just so happened that +[NSDictionary dictionaryFromFile:] used to
load as mutable whether or not you asked it do, but it doesn't break
API contract (because it's a bug if you send a mutation message to an
immutable object).
If you wanted mutable objects, you should've always said +
[NSMutableDictionary dictionaryFromFile:], or used
NSPropertyListSerialization and asked explicitly.
-bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden