Re: ListWillNotEmpty
Re: ListWillNotEmpty
- Subject: Re: ListWillNotEmpty
- From: "DigitEL @ Shaw" <email@hidden>
- Date: Fri, 08 Nov 2013 03:18:41 -0800
Thanks, Axel... its been years but I remember now something about the difference between 'set' and 'copy', subtle and very important distinction, hmmm, need to read more on this 'data sharing'.
Thanks again!
EL
On Nov 8, 2013, at 1:28 AM, Axel Luttgens wrote:
> 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
_______________________________________________
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