Skip navigation.
 
mlRe: NSDictionary question
FROM : Ondra Cada
DATE : Sat Nov 16 19:15:32 2002

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_removed>              http://www.ocs.cz
private        <email_removed>            http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlNSDictionary question Hisaoki Nishida Nov 14, 07:58
mlRe: NSDictionary question Andreas Mayer Nov 15, 00:45
mlRe: NSDictionary question Ondra Cada Nov 15, 01:11
mlRe: NSDictionary question Olivier Nov 15, 15:58
mlRE: NSDictionary question Jonathan E. Jackel Nov 15, 20:41
mlRe: NSDictionary question Craig Stanton Nov 15, 21:06
mlRe: NSDictionary question Andreas Mayer Nov 16, 01:58
mlRe: NSDictionary question Ondra Cada Nov 16, 11:28
mlRe: NSDictionary question Andreas Mayer Nov 16, 16:10
mlRe: NSDictionary question Ondra Cada Nov 16, 19:15
mlRe: NSDictionary question Andreas Mayer Nov 16, 20:22