title: Is it safe to use isKindOfClass: against an NSString instance to determine type?
body: <p>From the <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html#//apple_ref/occ/intfm/NSObject/isKindOfClass:" rel="noreferrer">isKindOfClass: method documentation in NSObject:</a></p>
  
  <p><strong>Be careful when using this method on objects represented by a class cluster. Because of the nature of class clusters, the object you get back may not always be the type you expected.</strong></p>
  
  <p>The documentation then proceeds to give an example of why you should never ask something like the following of an NSArray instance:</p>
  
  <pre><code>// DO NOT DO THIS!
  if ([myArray isKindOfClass:[NSMutableArray class]])
  {
      // Modify the object
  }
  </code></pre>
  
  <p>Now to give an example of a different use, let's say I have an instance of NSObject where I would like to determine if I have an NSString or NSArray.  </p>
  
  <p>Both of these types are class clusters - but it seems from the documentation above that the danger lies in the answer to isKindOfClass: being too affirmative (answering YES sometimes when you really do not have a mutable array) whereas asking a question about simple membership in a cluster would still be valid.  </p>
  
  <p>An example:</p>
  
  <pre><code>NSObject *originalValue;
  
  // originalValue gets set to some instance
  
  if ( [originalValue isKindOfClass:[NSString class]] )
     // Do something with string
  </code></pre>
  
  <p>Is this assumption correct?  Is it really safe to use isKindOfClass: against class cluster instances to determine membership?  I'm specifically interested in the answer for the omnipresent NSString, NSArray and NSDictionary but I'd be interested to know if it's generalizable.</p>