Set [list] to [value] strangeness (was: Re: (2 of 2) etc.)
Set [list] to [value] strangeness (was: Re: (2 of 2) etc.)
- Subject: Set [list] to [value] strangeness (was: Re: (2 of 2) etc.)
- From: Mr Tea <email@hidden>
- Date: Thu, 15 Apr 2004 01:04:26 +0100
On 14 Apr 2004, at 7.14 pm, Michael Terry wrote:
set {item 1 of {1, 2, 3}, item 2 of {1, 2, 3}, item 3 of {1, 2, 3}}
to {4, 5, 6}
Well, I liked that idea because it would corroborate my thinking that
the left hand side of 'set''s should be first class types, but if the
above were the case, then this should fail:
set {1, 2} to {3, 4, 5}
... but it doesn't.
And neither does this:
set {item 1 of {1, 2}, item 2 of {1, 2}} to {4, 5, 6}
It is almost as though the numbers on the left of 'to' are being
treated as variables.
Or is it? Here are some related conundra:
set {1} to 4
--> 4
set x to 1
set {x} to 4
--> error: can't get item 1 of 4
set {"what", "the", "hey?"} to "Verrry interestink, but stoopid!"
--> "Verrry interestink, but stoopid!"
set {"what", "the", "hey?"} to 4
--> 4
set h to "hey?"
set {"what", "the", h} to 4
--> error: can't get item 3 of 4
set h to "hey?"
set {"what", "the", h} to "Verrry interestink, but stoopid!"
--> "Verrry interestink, but stoopid!"
set {"Wed", April, "14th"} to (weekday of (current date))
--> Wednesday
set a to April
set {"Wed", a, "14th"} to (weekday of (current date))
--> error: can't get item 2 of Wednesday (no error if day is converted
to string)
So, it seems that a list can be converted into pretty much anything,
unless it contains variables, in which case it cannot be converted to
numerical values, AS constants & other things that do not have 'items'.
Surely a list should be more robust than this!
T.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.