Re: Is that really a bug at all? (was: Re: Ugly bug in Foundation, beware!)
Re: Is that really a bug at all? (was: Re: Ugly bug in Foundation, beware!)
- Subject: Re: Is that really a bug at all? (was: Re: Ugly bug in Foundation, beware!)
- From: Julien Dufour <email@hidden>
- Date: Sun, 6 Jun 2004 10:37:30 +0200
Hello
I think that the "bug/not bug" debate is pointless. The copy
implementation of the Cocoa collections is shallow. Fine. Both points
of view can be justified but the behavior is not going to change since
it would break many applications. The only thing that can (and should)
be done about it is to explicitly document the classes so that nobody
gets misled again.
However, shallow and deep copies are both useful. Although it is easy
to write some code providing the deep behavior (make some DeepCopy
protocol and a few categories), such a feature would be welcome
natively in the Cocoa frameworks. I'm pretty sure it would be more
efficient because of the class clusters.
Personally, especially concerning the collections, I would appreciate
something more customizable like:
- (id) deepCopyUsingFunction:(BOOL (*)(id))filter;
The "filter" function simply tells wether a given child should be
copied or not. Such a simple function is probably not flexible enough,
a context and maybe a reference to the original parent could be passed
along.
Best regards.
Julien Dufour
Inferiis -
http://www.inferiis.com
_______________________________________________
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.