• 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: Tue, 26 Jul 2005 17:35:13 +0100

Michael Sullivan wrote:

>>>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:
>
>Well, using copy makes the assing work as you expect.

No it doesn't. It performs a deep copy of the list object, so any mutable items within that list will also be duplicated. To shallow copy a list, you have to use 'items of <list>'.


>>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.
>
>I agree there's a problem, since the behavior is inconsistent in these scenarios, but I'm not sure it's a bug in the literal sense.  Is it guaranteed in the spec that concatenation always returns a new object a doesn't use references for the items?  I don't recall that.

It's implicit in the statement: 'binary operator joins two values' (p215). The expression '{} & lst' clearly isn't performing a join, therefore it's a bug.

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

References: 
 >Re: set myList to myList & ... and unexpected results (From: has <email@hidden>)

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