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

Re: globals


  • Subject: Re: globals
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 16 Sep 2010 11:18:22 -0400

On Thu, Sep 16, 2010 at 8:54 AM, tom wible <email@hidden> wrote:
> thanx to all for your replies:-) my problem is not that i don't know the
> difference between reference & value, it's that i don't know which way or
> when  a/s does it

As far as I know, strings (text) and numbers are the only things that
aren't passed around by reference.   Not everything passed around by
reference is necessarily mutable, however.


>...then there's the question of passing parameters: by
> value or reference...

Whatever the variable holds directly is what's passed to a function.
The variable itself is not passed by reference, so you can't change
what it holds, but if what it holds happens to *be* a reference to a
mutable item, you can change that item.

so this works:

to push(aList, anItem)
    set end of aList to anItem - leaves aList alone, uses it to find
list and modify it
end
set A to {}
push(A,1)
A    -- {1}

but this doesn't:

to push(aList, anItem)
    set aList to aList & anItem - changes aList to point to a new
list, but only within body of handler
end
set A to {}
push(A, 1)
A -- {}

>
> shane wrote:
>>
>> For mutable classes like list, record and date...
>> ...
>> For immutable classes like text, real, etc, ...
>
> now that's the kind of info i'd like to see in a table, not scattered in
> archives somewhere;-}
> _______________________________________________
> 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
>



--
Mark J. Reed <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: globals (From: tom wible <email@hidden>)

  • Prev by Date: Re: Test for valid URL?
  • Next by Date: Re: Test for valid URL?
  • Previous by thread: Re: globals
  • Next by thread: Select, Reveal and Column View
  • Index(es):
    • Date
    • Thread