Re: Determining if NSArray/NSDictionary is immutable
Re: Determining if NSArray/NSDictionary is immutable
- Subject: Re: Determining if NSArray/NSDictionary is immutable
- From: Bill Bumgarner <email@hidden>
- Date: Fri, 8 Jul 2005 22:03:24 -0700
On Jul 8, 2005, at 8:08 PM, email@hidden wrote:
And to cut a riposte off at the pass, I'm not interested in arguing
about the language semantics and theorising subtleties - in my
particular case I'm writing testers for code which I think really
should be returning mutable or immutable instances strictly, so
simply saying "it says it returns NSDictionary, so just don't
mutate it" isn't a good enough answer.
Given that you are writing a test harness, can you safely attempt to
modify the returned collection and catch the exception if it is
immutable?
I.e.
@try {
[returnArray addObject; 0];
} @catch {id e} {
/// nope, not mutable
return;
}
// hey, we mutated... boo.
_______________________________________________
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