On Jan 8, 2009, at 3:34 PM, Michael B Johnson wrote:

@property (readonly) NSMutableSet *activeMarkers;

You're right - it should be a set, not an array. But would it be mutable if it's readonly? What are the correct semantics for that, actually?


The "readonly" attribute only refers to the property itself, not the mutability / immutability characteristics of that property, so it's perfectly OK to have a readonly mutable property. That said, you typically wouldn't expose a mutable collection through an interface like that of course - it's a bit too promiscuous.

If performance allows, the easiest and most straight forward way to implement this would be to have an immutable collection, and to replace the entire collection whenever it changes. If you need better performance or granularity, you can use a mutable collection, but you need to ensure that you mutate the collection in such a way that you get the KVO behavior that you need.

j o a r


_______________________________________________

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

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

Reply via email to