Re: interesting discovery (trying to get record labels as strings)
Re: interesting discovery (trying to get record labels as strings)
- Subject: Re: interesting discovery (trying to get record labels as strings)
- From: has <email@hidden>
- Date: Mon, 3 Dec 2001 02:27:41 +0000
John W Baxter wrote:
[records]
>
It is trivial to build these things so that AppleScript can understand
>
them. It's also trivial to break them apart.
[must-not-cry... must-not-cry...]
>
Unfortunately, it's not
>
trivial to do either thing arbitrarily in AppleScript, which has only the
>
published ways to access items in records.
Ack. I imagine Olof Hellman would concur, having been there himself. I
dodged around the internals myself, which is why a lot of this stuff is
still very new to me (though it's making sense).
>
I had a reasonably favorable response a few months ago when I suggested to
>
Chris Nebel that
>
1. AppleScript forget about special casing record keys it knows about, for
>
making new records (it obviously has to deal with existing ones); and
>
2. provide access to the remaining one thing in a record, the "usrf" list.
>
>
But...there is no reason to expect to see the features any time soon, if at
>
all.
Although... I'm sure if folk are asking for it it can't hurt.
>
Given 2, one could learn what items are in a record, could build an
>
arbitrary record on the fly (rather than at compile time), etc.
And do it all 100 times faster than hashLib can. (Not that I ain't proud of
the little blighter, but I'd ditch in a second if you offered me the real
thing.)
>
Someone could write an OSAX... Aside from the OSAX boilerplate, it
>
would be about one screen of code to hold both functions.
Hey, my library is longer than that! ;) Now I'm wondering why someone
hasn't done it already? (I dunno how you'd deal with the mutating labels,
mind you... prefixing them maybe, but who wants their labels changing name
either?)
I suppose the other thing would be that if records are a bit too much of a
minefield, then perhaps a new data structure would be just as - or more -
convenient. Something like 'get "foo" of ["foo":"bar"]' might be easier for
users to understand and use than extra stuff tacked onto existing records.
Anyhow, I guess the ball's firmly in Apple's court at this point.
Cheers,
has