On Mar 17, 2012, at 10:58 PM, Luther Baker wrote:

> I was ruminating about it more of a (self) documenting angle as opposed to 
> runtime enforcement …

Cocoa’s idioms are different. In Cocoa you use mutable vs. immutable container 
types to indicate this. So if a method parameter is NSMutableString*, that 
means the method is allowed to modify the string. If the parameter is 
NSString*, it isn’t allowed to modify it (even if you actually passed in an 
NSMutableString*.) Likewise, no method declared in NSString’s @interface is 
allowed to modify the contents of the string, even if you call it on an 
NSMutableString.

In other words, look for the ‘Mutable’ in the class name the way you would look 
at ‘const’ in a C++ API.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to