Re: ListWillNotEmpty
Re: ListWillNotEmpty
- Subject: Re: ListWillNotEmpty
- From: Axel Luttgens <email@hidden>
- Date: Fri, 08 Nov 2013 10:28:09 +0100
Le 8 nov. 2013 à 09:31, DigitEL @ Shaw a écrit :
> Hey >
>
> I have the following:
>
> set displayList to {}
> set displayList to the mainList
> set beginning of displayList to "----"
>
> Each time I run the script the "----" keeps getting added cumulatively to displayList even though displayList should be emptied out. Meanwhile mainList occurs only once. Any idea why this is happening... a bug or is it the Tao of AS?
Hello,
Data sharing is very likely part of the phenomenon:
set mainList to {"a"}
set displayList to {}
set displayList to the mainList
set beginning of displayList to "----"
mainList
--> {"----", "a"}
In fact, "Set displayList to {}" is un-needed, since it is immediately overridden by the subsequent instruction.
On the other hand, should you want to avoid data sharing, you may use "copy", as in:
copy mainList to displayList
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden