Thread-topic: Changing AppleScript Records with Variable Identifiers
User-agent: Microsoft-Entourage/10.1.0.2418
>
> Anyway, the thing to remember is that AppleScript's record type is comparable
> to C structs, and NOT equivalent to NSDictionaries, Perl hashes, Python
> dictionaries, etc. (Unfortunately, this is a not uncommon misconception - even
> appearing in at least one published AppleScript book!) AS records and C
> structs are used to define complex rigid data structures at compile-time [1],
> whereas NSDictionaries, etc. are dynamic key-value data stores where key-value
> pairs can be added, retrieved and removed at run-time using arbitrary keys
> defined at run-time.
That is not true at all. First of all, AppleScript records are not
immutable: you can change the value of any key. (It's true you can't add
keys to an existing record, only via concatenation and resetting the same
variable to the result, and you can't remove keys.) Secondly, NSDictionary
is precisely a "rigid" immutable data structure: it's much more rigid than
an AS record in that you can't change the value of keys. It's
NSMutableDictionary which is dynamic: perhaps that's what you meant to say.
But when bridging AppleScript records to Objective C and back again, they
always bridge back as immutable NSDictionary rather than as
NSMutableDictionary, as Tim Bumgarner reiterated just yesterday on this
list. That's where problems arise: you can't bridge to NSMutableDictionary.
> The omission of a native dictionary type from AS is
> unfortunate, but that's AS for you.
record is a native dictionary type: its limitations are that you can't add
or remove keys as in fully mutable types.
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden
This email sent to email@hidden