• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ListWillNotEmpty
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: ListWillNotEmpty
      • From: "DigitEL @ Shaw" <email@hidden>
References: 
 >ListWillNotEmpty (From: "DigitEL @ Shaw" <email@hidden>)

  • Prev by Date: ListWillNotEmpty
  • Next by Date: Some Way to Run an AppleScript from an ExtendScript Command?
  • Previous by thread: ListWillNotEmpty
  • Next by thread: Re: ListWillNotEmpty
  • Index(es):
    • Date
    • Thread