• 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: set myList to myList & ... and unexpected results
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: set myList to myList & ... and unexpected results
  • Next by Date: Re: obligatory snipe [was Re: how can script bundles store extra stuff?]
  • Previous by thread: Re: set myList to myList & ... and unexpected results
  • Next by thread: Re: set myList to myList & ... and unexpected results
  • Index(es):
    • Date
    • Thread