Re: record labels as strings, etc -- a cut-out-and-keep summary
Re: record labels as strings, etc -- a cut-out-and-keep summary
- Subject: Re: record labels as strings, etc -- a cut-out-and-keep summary
- From: has <email@hidden>
- Date: Tue, 4 Dec 2001 16:57:08 +0000
Gosh. Never thought I'd stir up such a hornet's nest of debate as this...:)
Still, I think I've done enough damage on this thread already; time to find
something else to terrorise now. But here's one last eyeball-rollin',
brain-burstin' summary before I shut up...
Summary of record-based hash techniques:
The double-coercion method is faster than any other option, but it's also
worryingly fragile. No-one's figured an equivalent method for getting
values back out again using strings as keys (at least not yet) so you'll
need to use one of the other methods for this. Thanks due to Chris though
for saying he'll try to leave the hole open till something better comes
along.
Neal and Olof's "run script"-based methods for both getting and setting
records are more robust, though not too fast. I'm not clear if they also
rely on AS weaknesses or if they're 100% honest and trustworthy techniques.
Maybe Neal/Olof could confirm this?
hashLib (from ScriptBuilders @ macscripter.com) gives a good balance of
reliability (very robust as it doesn't use hacks) and speed (its faster
than "run script"-based methods). Should cover everything you need. Not a
vanilla solution, however, as it's dependent on Smile.
Summary of non-record methods:
Plenty choices, each with their own strengths and weaknesses. Most are
vanilla; all should be reliable. Choose whichever suits your requirements
best:
Map Objects (esglabs.com), AssociativeLib (applemods.com),
TableSearchServices (applemods.com) -- List-based storage; can store any
type of object; some use ordered lists with faster binary lookups
(restrictions on key types); others use unordered lists with slower lookups
(any key type); keys are case-insensitive.
Arthur Knapp's as-yet unamed and undistributed TID-based pseudo-hash --
Text-based storage; fast, especially for lookups; limited to strings for
keys and values; keys are case-sensitive.
Jeff Baumann's Tanaka's OSAX-based flat database -- Text-based storage;
fast; limited to strings for keys and values; good for short- and long-term
data storage; requires 3rd-party osax.
(Hope I didn't miss anyone.) Hopefully Jeff & Arthur's new methods get
wider public distribution in future (these are too cool to keep quiet
about, guys;).
For the future:
The AppleScript team will implement some form of true hashes at some
indeterminate time (fingers crossed). Or else they'll have a joint nervous
breakdown caused by one too many '{{<<class usrf>>:{"hello", "goodbye"}}}
as string as record's. ;)
Cheers,
has