Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing AppleScript Records with Variable Identifiers



Paul Berkowitz  wrote:

>>Anyway, the thing to remember is that AppleScript's record type is comparable to C structs [...] AS records and C structs are used to define complex rigid data structures at compile-time
>
>That is not true at all. First of all, AppleScript records are not
>immutable: you can change the value of any key.

I never said records were immutable. I said their structure was. You misread.


>Secondly, NSDictionary is precisely a "rigid" immutable data structure [...]
>NSMutableDictionary which is dynamic: perhaps that's what you meant to say.

Oops, yes. Meant NSMutableDictionary (though not for the reasons you think).


>record is a native dictionary type:

It is NOT a dictionary type. Let me see if I can provide a better definition as that first one wasn't so great:

- A dictionary is a collection of key-value pairs where both the keys and values are objects. To retrieve a value from a dict, you pass it an object which it uses as a key to look up the corresponding value. Mutability [1] is a red-herring, btw; what's signficant is how the data is stored.

- An AppleScript record is collection of properties defined at compile-time (comparable to a C struct or a class instance containing only public instance variables). Only the values are objects; the properties they're stored in are part of the record's structure, not its content. To retrieve a value from a record, you refer to the property that contains it using the appropriate identifier.

Hope that clarifies,

has

[1] With immutable dicts, key-value pairs are added when the object is created; in mutable dicts, they can be added, removed and replaced at any time. The data is stored and retrieved exactly the same way though.
-- 
http://freespace.virgin.net/hamish.sanderson/
 _______________________________________________
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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.