• 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: Chris Page <email@hidden>
  • Date: Sun, 3 Oct 2004 01:38:31 -0700

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

In the following examples, I set a local variable to a value, and then pass that variable down to a handler as a parameter. In the handler, I change the value of this parameter. I would expect this change to be local to the handler only, and not global to the script. So, at the main level of the script, I would expect the variable to retain it's original value, no matter what happens to it in the handler.

Here's a revised copy of something I posted last year on the topic:

AppleScript is very simple, but I think the ASLG makes it sound more complicated than it really is when it tries to describe "sharing". Here's how it really works (for my definition of "really"):

Every value is an object.

Properties, variables, arguments, and the items of lists and records refer to objects; they are not themselves objects, and they do not contain objects any more than your name contains you. Any number of them can refer to the same object, just as one person can be known by various people and by various means, such as name, nickname, or reputation.

Some objects are mutable -- you can change them -- like lists and records, and some are not, like numbers and strings (they are "immutable".) You can change hairstyles, but you cannot change your date of birth.

If an object is mutable and you change it, that change will be visible to everything that refers to it, just as everyone who knows you will notice when you dye your hair bright orange.

'set' makes a variable, etc., refer to an object.

'copy' makes a copy of an object, then makes a variable, etc. refer to the copy.

Calling a function with a value makes the argument in the function refer to that object.

That's it.

--
Chris Page - Software Wrangler - Dylan Pundit

  Open Source Dylan: <http://www.gwydiondylan.org/>
  Dylan Blogging: <http://homepage.mac.com/chrispage/iblog/>
  Dylan Shopping: <http://www.cafepress.com/chrispage>

_______________________________________________
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: Doug McNutt <email@hidden>
  • Prev by Date: Re: AppleScript Formatting - Strings
  • Next by Date: Re: UI Scripting PowerMail
  • Previous by thread: Re: Variable Ponderance
  • Next by thread: Re: Variable Ponderance
  • Index(es):
    • Date
    • Thread