Re: RS: Reply about NSObject members class, isMemberOfClass, isKindOfClass
Re: RS: Reply about NSObject members class, isMemberOfClass, isKindOfClass
- Subject: Re: RS: Reply about NSObject members class, isMemberOfClass, isKindOfClass
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Mon, 10 Sep 2007 14:03:45 +0200
On 8 Sep 2007, at 08:04, email@hidden wrote:
On Sep 7, 2007, at 4:04 PM, Roland Silver wrote:
The reason I need to know whether an object is a mutable array is
that in a current program I have bugs involving APPARENTLY creating
NSMutableArrays that turn out not to be mutable, and I need help to
track down where the bugs are.
In any case, it should never be necessary to check whether an array is
mutable or immutable. The method signature that you get the object
from will tell you how you should treat it; for example, the result of
a method declared as returning an NSArray should never be treated as
an NSMutableArray.
I have a method which gets an NSArray, but I know that sometimes it
really gets supplied with a mutable thing.
This method needs to do something with the array. So it would like to
do:
if ( ![myArray isMutable] ) myArray = [myArray mutableCopy];
As you said, it is not *necessary* to check the mutablity of myArray
- but it cleary would be more efficient.
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden