Theocacao
Leopard
Design Element
Comment on "Mike Lee on Cocoa"
by Nicko — Nov 08
A set is different from an array, but way more different than a string

I see where you're trying to get to, but I'm not sure this is good for Cocoa to adopt in general.


I think that much of what Mike is after could be achieved by simply making NSArray, NSSet and NSDictionary sub-classes of an abstract 'NSCollection' and moving the API commonalities such as enumeration and tests of membership into the superclass. That way code which can be generalised to not care what sort of collection is needed could just accept an NSCollection and still have some degree of type checking, as opposed to having to accept an NSObject and not notice until runtime that an NSWigglyWidget is inappropriate.
Back to "Mike Lee on Cocoa"
Design Element

Copyright © Scott Stevenson 2004-2015