• 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: copy & set statements
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copy & set statements


  • Subject: Re: copy & set statements
  • From: Timothy Bates <email@hidden>
  • Date: Wed, 24 Oct 2001 11:14:26 +1000

On 24/10/01 6:52 AM, "email@hidden" <email@hidden> wrote:

> On Date: Tue, 23 Oct 2001 11:00:42 +1000, Timothy Bates <email@hidden>
> asked,
>
>> To get the behaviour implied (where a handler deals with the original copy
>> of a list), you need to say
>>
>> set theCat to {"woody", "hungry"}
>>
>> myHandler()
>>
>> theCat
>>
>> on myHandler()
>> global theCat
>> set theCat to "a"
>> end myHandler
>
Here you said
"Unless you pass a reference to a function, AppleScript functions are pure
functions: they don't mess with their arguments."

But earlier you noted

"Actually, everything is passed as a pointer"

So Iam confused. The fact seems to be that everything is passed as a
reference (pointer) but that quite often dereferencing (copy to) is invoked
without our needing to worry about it.

But that is not the same as "AppleScript functions don't mess with their
arguments." What did you mean by the latter? Especially the quote below is
hard to implement as a scripter, because as you noted, AS indeed passes
references to functions

> I wouldn't recommend the C-like approach of passing a reference into a
> function,
> and fiddling with the contents of that reference, since pointers and addresses
> are a significant source of bugs and confusion in C. Why use the most
> difficult
> and easy-to-screw-up construct in the language?

unsure but curious,

tim


References: 
 >Re: copy & set statements (From: email@hidden)

  • Prev by Date: Re: copy & set statements
  • Next by Date: Re: Your Script :) Re: AppleScript to get UserName!??
  • Previous by thread: Re: copy & set statements
  • Next by thread: Re: copy & set statements
  • Index(es):
    • Date
    • Thread