Toll-free bridging, say for NSDictionary and CFDictionary.
Toll-free bridging, say for NSDictionary and CFDictionary.
- Subject: Toll-free bridging, say for NSDictionary and CFDictionary.
- From: "email@hidden" <email@hidden>
- Date: Fri, 21 Aug 2009 15:56:50 +0100
Snippet from this recent thread: Re: When do I need to override hash?
<--
Each bucket might be implemented as an array or as a linked list or
some other data structure, but whatever it is, if it contains more
than one key object, the implementation picks the correct one by
searching the bucket using -isEqual: or -compare:
reply: email@hidden
FWIW, the actual implementation isn't based on the technique you're
talking about here (which is generally called separate chaining), but
it uses linear probing (see e.g. Sedgewick if you're interested in the
details). It still, of course, needs to be able to test keys for
equality with -isEqual:.
-->
How is this known to be true, I thought (unless one has access to the
Cocoa source).
We can dig into http://www.opensource.apple.com/source/CF/CF-476.19/CFDictionary.c
and sure enough we find buckets being probed.
But what does this tell us about NSDictionary?
Yes, we know it's toll-free bridged to CFDictionary but does that
imply total equivalence at both the data structure and method/
algorithm level?
Does NSDictionary merely defer to CFDictionary for all its
functionality or or they functionally distinct, ie: is NSDictionary
implemented via calls to CFDictionary?
Is the answer to the above question true for all toll-free bridged
Cocoa classes?
Jonathan Mitchell
Developer
http://www.mugginsoft.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden