Re: NSMutableArray morphs itself into an NSArray?
Re: NSMutableArray morphs itself into an NSArray?
- Subject: Re: NSMutableArray morphs itself into an NSArray?
- From: Allan Odgaard <email@hidden>
- Date: Tue, 9 Mar 2004 15:03:32 +0100
On 9. Mar 2004, at 14:20, Jerry Krinock wrote:
Is it possible that Fink somehow patches his
system to make it more sensitive to my mistakes?
I sincerely doubt it -- many methods which are declared to return an
NSArray actually do return an NSMutableArray (which is why your code
works) -- if you read the release notes you'll see that Apple is
actually changing some methods which previously did return a mutable
array to returning an immutable.
One possible implementation of stringsSeperatedByComponent: could be
something like this:
NSRange r = [self rangeOfString:component];
if(r.location == NSNotFound)
return [NSArray arrayWithObject:self];
NSMutableArray* res = [NSMutableArray array];
do {
...
} while(...);
return res;
So you see, wether or not the result is mutable would depend on input!
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.