Re: definition list recommendations?
Re: definition list recommendations?
- Subject: Re: definition list recommendations?
- From: has <email@hidden>
- Date: Wed, 26 Jan 2005 15:21:19 +0000
Emmanuel wrote:
Since the release by Satimage-software of XMLLib.osax (that we offer
for free), you can consider that AppleScript has associative arrays
(aka dictionaries, aka lookup tables etc.)
Significant caveat here... XMLLib suffers the same problem as any
other osax: it only really works with basic datatypes (numbers,
strings, lists, etc.), and will duplicate any mutable values (lists,
records, etc.) passed to it. A true dictionary-style object should be
able to store _any_ kind of value (basic types, application
references, etc.) quickly, efficiency and without duplication. For
XML/plist processing it's the bee's knees, but as a general-purpose
dictionary it's less than ideal.
The best third-party solution would, I suspect, be to use either some
sort of balanced B-tree based structure implemented in native
AppleScript code, or a hybrid osax/native solution that uses an
osax-based command to quickly and efficiently hash string-based keys
(something AS is much too slow and clumsy to do itself) with the rest
of the data structure implemented in AppleScript.
Meantime, my Types library's Dictionary object is probably the best
option. In terms of raw speed it's about level with XMLLib (i.e.
they're both dog-slow compared to a native dictionary type), and it
won't take a bath when storing complex values. It's only real problem
is that adding new items becomes rather inefficient as the number of
unique stored keys increases. But if you're only adding a couple
thousand then this should be quite tolerable; and looking up existing
values, which is probably what you're mostly doing anyway, is very
efficient.
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden