Re: does property exists in a record
Re: does property exists in a record
- Subject: Re: does property exists in a record
- From: Timothy Bates <email@hidden>
- Date: Mon, 13 Aug 2001 11:59:54 +1000
On 13/8/01 6:02 AM, "Jason W. Bruce" <email@hidden> wrote:
>
How does a hash array differ from an AppleScript record, and why is it
>
called a hash array?
Probably the more common name for hash arrays is "Associative Array"
You have seen these hundreds of times already, whenever you submit a web
form and see something like:
www.apple.com/wo?user=tim&request=help
This sends an associative array which in current AppleScript you might think
of as {user:"tim", request:"help"}
With an associative array, you can still ask for item 3, but you can also
ask for items by name, and the associated value is returned.
So, associative array stores {name:value} pairs - just like the items of a
record.
A big difference is that both the name and the value are editable, so you
can set the name (which you can't do with a record as yet).
I think that AppleScript would be enhanced if all arrays were associative.
This can be done transparently - array items simply take their item index as
a default name.
They are called hash arrays because the system uses a hash function to
uniquely identify each item, thus giving allowing named access to retain
index-like speed.
tim