Re: set myList to myList & ... and unexpected results
Re: set myList to myList & ... and unexpected results
- Subject: Re: set myList to myList & ... and unexpected results
- From: "Nigel Garvey" <email@hidden>
- Date: Mon, 25 Jul 2005 01:13:58 +0100
has wrote on Sun, 24 Jul 2005 11:09:40 +0100:
>Ryan Wilcox wrote:
>
>>Perhaps someone here can help me with a puzzle. Run the following code:
>>
>>- --<code language="Applescript>
>>
>>set myList to {}
>>set myItem to {1}
>>
>>set myList to myList & myItem
>>set item 1 of myList to 123
>>
>>set myList to myList & myItem
>>
>>- --</code>
>>
>>The output of this code is {123, 123}, and NOT {123, 1} like I would
>>expect.
>>
>>Could someone explain why I get this result, please?
>
>It's a bug, file a report. The first concatenation returns the right-hand
>operand directly instead of creating a new object.
Amazing! The same bug's on my OS 8.6 system, so it's been around since at
least AS 1.3.7, but Ryan's apparently the first person to have noticed it.
It also affects the concatenation of records. ({} can be regarded as an
empty record as well as an empty list.)
set myRecord to {}
set myItem to {fred:1}
set myRecord to myRecord & myItem
set myRecord's fred to 123
myItem
--> {fred:123}
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden