Re: records [was Re: [appscript] looking for feedback]
Re: records [was Re: [appscript] looking for feedback]
- Subject: Re: records [was Re: [appscript] looking for feedback]
- From: has <email@hidden>
- Date: Tue, 25 Oct 2005 21:22:11 +0100
Mark J. Reed wrote:
>>When the AS record is packed into an Apple event, any AS identifiers are stored as strings along with their corresponding values in a key-value list, which in turn is stored in the AERecord under the key 'usrf'.
>
>Ah. That makes a certain amount of sense. And the intermingling of keys stored as codes vs strings stored in a list of strings probably goes a long way toward explaining the lack of a "give me the keys" operation on AS records.
Not really. That sort of operation doesn't fit with the semantics of a 'record' type, where the fixed 'collection of properties' structure is rather the point. The real question is why AS's designers decided to endow it with a relatively inflexible 'record' type rather than a more versatile 'hash' (aka 'dictionary') type as most scripting languages do. Certainly, appscript maps AERecords to dictionaries just fine; e.g. in Python the above AERecord would unpack as:
{k.name: "foo", k.size: 22, "someIdentifier": true, "anotherIdentifier": false}
But as with many things in AS, go figure.
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