• 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 vs copy?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set vs copy?


  • Subject: Re: set vs copy?
  • From: Alex Zavatone <email@hidden>
  • Date: Wed, 15 Sep 2010 01:55:53 -0500

it never gets its own value.  B points the values in A.   This is because a list is the variable value.

On Sep 15, 2010, at 1:51 AM, Thomas Fischer wrote:

> Hi Mark,
>
> I still don't understand when the second variable get its on value.
> I agree that your example shows nicely that A and B point to the same variable.
> But
>
> set A to {1, 2, 3}
> set B to A
> copy A to C
> set A to {6, 7, 8}
> set text item delimiters to ","
> log ("A is " & A as text)
> log ("B is " & B as text)
> log ("C is " & C as text)
>
> yields
>
> (*A is 6,7,8*)
> (*B is 1,2,3*)
> (*C is 1,2,3*)
>
> Why that?
>
> Cheers
> Thomas
>
>
> Am 15.09.2010 um 01:51 schrieb Mark J. Reed:
>
>> set A to {1,2,3}
>> set B to A
>> copy A to C
>>
>> set end of A to 4
>> set end of B to 5
>>
>> set text item delimiters to ","
>> log("A is " & A as text)
>> log("B is " & B as text)
>> log("C is " & C as text)
>>
>> Result:
>>
>> A is 1,2,3,4,5
>> B is 1,2,3,4,5
>> C is 1,2,3
>>
>>
>> A and B are both pointing to a single list; changing that list,
>> whether you go through A or B, results in a change visible through
>> both.  C is a separate copy of that list made when it only had 3
>> elements, unaffected by subsequent modifications to the original.  You
>> can, of course, now go and modify C, and it won't affect A or B.
>> _______________________________________________
>> 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

 _______________________________________________
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

References: 
 >Re: set vs copy? (From: Shane Stanley <email@hidden>)
 >Re: set vs copy? (From: Bruce Robertson <email@hidden>)
 >Re: set vs copy? (From: "Mark J. Reed" <email@hidden>)
 >Re: set vs copy? (From: Thomas Fischer <email@hidden>)

  • Prev by Date: Re: set vs copy?
  • Next by Date: Re: I need to allow a web page to fully load before saving it with my script
  • Previous by thread: Re: set vs copy?
  • Next by thread: Re: set vs copy?
  • Index(es):
    • Date
    • Thread