Re: fun with records and keywords
Re: fun with records and keywords
- Subject: Re: fun with records and keywords
- From: Brennan <email@hidden>
- Date: Thu, 18 Oct 2001 20:59:35 +0200
has <email@hidden> wrote:
>
I found the following oddly amusing (maybe I've been at the computer too
>
long...?):
>
>
set x to {class:string, contents:"test"}
>
>
get class of x
>
--> string
>
>
get contents of x
>
--> "test"
>
>
It looks like my properties are overriding the object's own when I query
>
them. Bizarre. Is that what's expected?
>
>
Useful? Safe to use?
Yes. This is acceptable and expected. Sort of.
It's not smart to create a new structure and give it a class property which has the same value as an existing class, because things can get very confusing. 'Real' strings can do a whole bunch of other things that your little record can't. Your call.
However, there's nothing to stop you defining the 'class' of a record or script object. Some purists might even say it's good practice to provide a 'class' property with every custom structure. (I never heard anyone say this, but I can imagine it happening).
>
From ASLG:
"The Class property of a record can be modifiedit is not read-only".
(page 75)
-brennan