Re: NSDictionary question
Re: NSDictionary question
- Subject: Re: NSDictionary question
- From: Ondra Cada <email@hidden>
- Date: Sat, 16 Nov 2002 19:15:32 +0100
On Saturday, November 16, 2002, at 04:10 , Andreas Mayer wrote:
Nope. You don't know and don't need to know, unless
... combined with this ...
or (b) it is self-evident
... really doesn't make it easier for the newbie. ;-)
Haven't I said something of "it should be in docs anyway"? Well it should,
but is not -- at least, I can't remember seeing any excerpt which would
exlicitly state that a, say, delegate is not copied. Presumably it was not
documented since, well, it's one of those self-evident cases ;)
I would argue those "most cases".
OK, maybe I am writing funny code. ;-)
There _are_ cases when an object is treated like a value (a string, a
number, a identifier, etc.); in those cases you'll want to make a copy.
Otherwise you use references.
Add "usually", and I'll sign that ;)
Better?
I think we actually don't need to argue: what I am (quite probably
mistakenly) aiming at is to make the thing clean to newbies. Of course for
them it would be best if it was always documented -- but it just is not.
Therefore, I think they should ask themselves:
(a) is the behaviour documented? If so, we know, no need to muse on;
(b) would be a copy an obviously stupid and nonsensical thing (like with a
delegate)? If so, it's referenced;
(c) would be a reference ... (ditto)? If so, it's copied (actually, this
hardly ever happens -- but for the dictionary keys which luckily fall to
(a), I can't think offhand of any example);
(d) otherwise we MUST be prepared for any of the alternatives: it might be
either copied or referenced, and it is even possible the way would change
in the next main release ;)
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.