Re: Ugly bug in Foundation, beware!
Re: Ugly bug in Foundation, beware!
- Subject: Re: Ugly bug in Foundation, beware!
- From: Ondra Cada <email@hidden>
- Date: Thu, 3 Jun 2004 16:15:33 +0200
Zach,
On 3.6.2004, at 15:40, Zach Wily wrote:
>
Nowhere in the documentation (that I can find) does it say that
>
[NSMutableArray -copy] performs a deep copy. Why do you assume that it
>
does?
For it is the only logical thing presumed copy should give me my own,
non-shared snapshot of the object, useable for tasks like undo. Which
it should.
Among others, the howler makes it pretty impossible to use a decent
hash -- now it is self-evident why using arrays for dictionary keys is
so terribly inefficient!
>
(If it were to perform a deep copy, you'd only be able to add objects
>
to NSMutableArrays that conformed to NSCopying, which I don't think
>
any of us want.)
Such objects of course would be shared. If a non-copiable object is
used in a structure of which a snapshot is to be taken, it is a similar
*programmer's* bug as if placing a mutable and shared object into an
immutable array.
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.