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 19:33:59 +0200
Marco,
On 3.6.2004, at 19:17, Marco Scheurer wrote:
>
> A deep immutable copy makes my own immutable snapshot of the complete
>
> structure: many great usages(*). A shallow mutable copy makes, well,
>
> a mutable copy--an array with the same contents which I can
>
> subsequently change: many great usages. Shallow immutable copy? In
>
> twenty-odd years of object-oriented programming I haven't bumped into
>
> a reasonable usage of that. What would it be?
>
>
Easy: enumerating the shallow copy and removing some objects from the
>
original.
Hmmm... yup, right, although I rather tend to collect a list of objects
which are to go, removing them all at once at the end.
Nevertheless, right you are, this is very valid.
Still though, I would use +arrayWithArray: for this rather than -copy:
even if they did the same by definition, intention-revealing side, I
don't want "a copy of the array" for this, for that is too hi-level.
Here, I want explicitly "another array sharing the same contents".
Perhaps the very design of copy/mutableCopy is somewhat unclean and
unlucky, and we should have instead something like
snapshot/copy/mutableCopy/deepCopy, the inner two by definition shallow
just changing the mutability, the last by definiton exactly copying
whatever there is (i.e., making a mutable copy of a mutable object, an
immutable copy of an immutable one--in fact, sharing it)? Or something
alike...
---
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.