• 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: Variable Ponderance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variable Ponderance


  • Subject: Re: Variable Ponderance
  • From: Michelle Steiner <email@hidden>
  • Date: Thu, 30 Sep 2004 10:40:03 -0700


On Sep 30, 2004, at 10:27 AM, Ben Waldie wrote:

In the first example, I pass down a variable containing a number, completely change it to a value of 2, and the variable at the top level of my script behaves as I would expect, retaining its original value. In the second and third examples though, I pass down a variable containing a list or a record, modify part of the list or record, and the variable at the top level of my script does not behave as I would expect. In these 2 cases, the main script treats the variable as it if is a global, remembering the change I made in the handler. This appears to occur only when manipulating the variable, and not when changing it completely. Is this the intended behavior?

It is analogous to the difference between set and copy.

set x to {1, 2, 3}
set y to x
set item 2 of y to 9
return x
--> {1, 9, 3}

set x to {1, 2, 3}
copy x to y
set item 2 of y to 9
return x
--> {1, 2, 3}

--
If you don't hit any bumps in the road, you're not moving.

_______________________________________________
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: Variable Ponderance
      • From: Ben Waldie <email@hidden>
References: 
 >Variable Ponderance (From: Ben Waldie <email@hidden>)

  • Prev by Date: Re: Variable Ponderance
  • Next by Date: Re: Variable Ponderance
  • Previous by thread: Re: Variable Ponderance
  • Next by thread: Re: Variable Ponderance
  • Index(es):
    • Date
    • Thread