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: has <email@hidden>
- Date: 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. Not an issue with immutable types such as strings, but very bad for mutable objects.
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
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