• 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: Mon, 25 Jul 2005 16:37:38 +0100

Michael Sullivan wrote:

>>>>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.
>
>This isn't a bug, it's a feature :)

No, you've misread the problem. This has nothing to do with set vs copy. It's about the concatenation operator not returning a new object in certain situations. Example:

set l to {1}
set a to l & {}
set b to {} & l
set c to {0} & l

set l's item 1 to 2
log a --> {1}
log b --> {2} -- Wrong! Should be {1}
log c --> {0, 1}

When its first operand is an empty list, the '&' operator returns its second operand instead of a new object. This is a bug. In every other case, a new object is created and returned as you'd expect.

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

  • Follow-Ups:
    • Re: set myList to myList & ... and unexpected results
      • From: Emmanuel <email@hidden>
  • Prev by Date: Print selected file in the Finder
  • Next by Date: Re: My first question, please be gentle (stack overflow)
  • 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