Re:Cocoa's NSMutableArray changes implementation based on th...
by rosenjon on Tuesday April 05, 2011 @11:16PM
(#2413777)
I'm don't get why this is surprising. NSArray takes a static dataset, and cannot be changed. NSMutableArray, by definition, can add or delete items. Wouldn't it make sense to store an array that is huge differently than one that is of small -> medium size? And since NSMutableArray must be able to change, it can't necessarily allocate the correct memory space upon alloc.
[ Parent
| on HN ]
Re:Cocoa's NSMutableArray changes implementation based on th...
by tomwans on Tuesday April 05, 2011 @11:37PM
(#2413821)
it is surprising because most people probably expect NSArray to just work like a plain array (see the naive C implementation)
Re:Cocoa's NSMutableArray changes implementation based on th...
by rosenjon on Wednesday April 06, 2011 @10:48AM
(#2415264)
I think the ability to combine C code in Obj-C allows for the usage of a huge legacy code base. However, I wouldn't be surprised if there was a design decision at some point that deliberately made it harder to port NextStep (NS) objects back to C. Creates lock-in...