Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mutability?



Fuerthaller wrote:

[...]
> I hope you can aggree on my scenarios that
> there might be some reasonable use cases
> for the mutability status of an object.

Like you I think there are perfectly legitimate use cases where it makes sense to determine at run-time whether a string is mutable, especially in a dynamic language like Objective-C. Yes, this can be misused and dangerous, but no more than the possibility of asking an object about its class. And I hope no one is thinking about removing this feature from Objective-C ;-)

I don't think that the right way to offer information about mutability would be to add a public API. As you noted, the problem at hand comes from the fact that, in the current implementation, non-mutable strings are instances of a subclass of NSMutableString (how something like that can pass design reviews and finds its way into the, otherwise excellent, major framework of a major operating system will be a subject of amazement for generations of developers). Just fix this nonsense and the problem will disappear.

Best,

Philippe Mougin
F-Script: Interactive and scripting environment for Cocoa.
http://www.fscript.org
_______________________________________________
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.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.