| To: | REALbasic NUG <realbasic-nug@lists.realsoftware.com> |
|---|---|
| Subject: | Re: How to use custom comparison for matching in Dictionary? |
| From: | Thomas Tempelmann <tempelmann@gmail.com> |
| Date: | Tue, 30 Mar 2010 01:10:31 +0200 |
| Authentication-results: | mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com; dkim=neutral (body hash did not verify) header.i=@gmail.com |
| Delivered-to: | listarchive@realsoftware.com |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:received:message-id:subject:to:content-type :content-transfer-encoding; bh=xKMAa0fX4BnXhMqMUbY140ZI4cKcT5Ejny8Sck4wXzU=; b=G7dPzCYbX9ywnhZ5VD/XrUDDHpngzgzKcuMko/6WYecJekGbVpEXjLHs72PRHyMo/7 gNaqWytsrXCAID0mDtErRm1vYk9qtX5yAdTbt/8tBHxzrtghVckGmzHjfp0S67fn9g4D TI10zvs0utu2z5zGJEqFfEBNsi+a1p0cIa0uI= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=TBAkKQYIzzvB8r3S+/m5D49xd6W+o/d8VPR93FHX02MTF4iMeGOjMYK7ng/2UrQ0Ie fYkr/AXPa71OrM+OjMGiA4paZID2NiJn1UInH1Th+guTz5NTFCjJb3tWmGkK7dZvLmpY XcUmFNRStbCozPTQTqAoFrtL66cG29aDVjniQ= |
| In-reply-to: | <FE05BB3F-84D7-442B-B6B1-9A1002020217@kellerfarm.com> |
| References: | <89fe53801003280811p4ae8b564y24049aa8d4c34908@mail.gmail.com> <FE05BB3F-84D7-442B-B6B1-9A1002020217@kellerfarm.com> |
| Reply-to: | REALbasic NUG <realbasic-nug@lists.realsoftware.com> |
| Sender: | realbasic-nug-bounces@lists.realsoftware.com |
On Mon, Mar 29, 2010 at 23:26, Andrew Keller <andrew@kellerfarm.com> wrote: > If two separate objects generate the same hash value, then the Dictionary >considers them them to be identical. I sure hope not! A dictionary, using key-value coding, may use a hash only for optimization but not for the final decision on what keys are equal. That would be very bad, as the very nature of hash values allows two objects or values to have the same hash value, even if they are not equal. Instead, there's a "collision" concept and a list involved: Different values with same hash values are all remembered in a list, and when looking up a value, the list behind its hash value must be search. So, in a way, a dictionary using a hash table is only reducing the number of searches it would have to do, and its cost is more memory usage. Funny though - Aaron Ballman had the same misconception a few years ago, and that led to an obscure, thus nasty, bug in the code managing WeakRefs, leading to the occasional leak or crash. And yes, there are hash table algorithms that ensure that there are no collisions. But they require certain requisites, and thus are a special form. The common rule for dictionaries using hash tables, though, is that collisions happen and that's not enough to do the matching. HTCIUFY, Thomas -- Thomas Tempelmann, http://www.tempel.org/ _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html> |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: AcceptFocus issues with full keyboard access., Sven E Olsson |
|---|---|
| Next by Date: | Re: realbasic-nug Digest, Vol 72, Issue 80, John Snyder |
| Previous by Thread: | Re: How to use custom comparison for matching in Dictionary?, Charles Yeomans |
| Next by Thread: | Re: How to use custom comparison for matching in Dictionary?, Christian Schmitz |
| Indexes: | [Date] [Thread] [Top] [All Lists] |