Re: Records
Re: Records
- Subject: Re: Records
- From: Richard 23 <email@hidden>
- Date: Fri, 2 Mar 2001 01:46:48 -0800
>
From: Simon Forster <email@hidden>
>
To: <email@hidden>
>
>
> From: Daniel Shockley <email@hidden>
>
>
> However, I tried it as follows and got a disappointing result - I'm not sure
>
> why:
>
...
>
> listToRecord({"firstName", "Dan", "lastName", "Shockley"})
>
> -- returns {|firstName|:"Dan", |lastName|:"Shockley"}
>
>
It would appear that you have to use all lowercase letters for property
>
names - at least using Olof's method.
>
>
firstname, first_name are OK
>
>
firstName fiRstname FIRSTNAME are not.
>
>
Is this an intrinsic limitation to property names? I'll check it later.
JM Baumann added:
>
Simon is right. Darned shame really. That's probably a deal killer for what I
>
want to use it for. Oh well.
Aww, c'mon fellas! Turn those frowns upside down! Is it really a purely
a case of case inspiring those rainy day attitudes?
Seems you've overlooked a minor detail.
Uppercase, lowercase, It's all the same to AppleScript which
is not case sensitive, well as far as symbols (variable names)
are concerned.
The first time you declare a variable, the capitalization is
noted and any variation using the same letters compiles to
your initial arrangement:
local theValue
both of these will change to "theValue" upon compilation
thevalue
THEVALUE
usrf names are always transmitted in lowercase, but if you declare the
variable first you'll get the aesthetic result you want:
-- ---------------------------------------------------------
-- Preprocessed by Convert Script 1.0d4
-- ---------------------------------------------------------
-- author: Richard 23, date: Friday, March 2, 2001
-- ---------------------------------------------------------
local theItem, theIndex
make usrf with properties {"theitem", "wrench", "theindex", 42}
--> {theItem:"wrench", theIndex:42}
script usrf
on make with properties theList
record {<<class usrf>>:theList} as record
end make
end script
-- ---------------------------------------------------------
Now cheer up you gloomy gusses! B-)
R23