Re: copy & set statements
Re: copy & set statements
- Subject: Re: copy & set statements
- From: Timothy Bates <email@hidden>
- Date: Tue, 23 Oct 2001 11:57:35 +1000
On 23/10/01 11:53 AM, "Deivy Petrescu" <email@hidden> wrote:
>
> I believe the information below is not correct?
>
>
>
> set theCat to {"woody", "hungry"}
>
>
>
> myHandler(theCat)
>
> return theCat
>
>
>
> -->>{"woody", "hungry"}
>
>
>
> on myHandler(myList)
>
> set myList to "a"
>
> end myHandler
>
>
I believe you meant:
>
>
set theCat to {"woody", "hungry"}
>
>
set theCat to myHandler(theCat) --alternatively return myHandler(theCat)
>
return theCat
>
>
-->>a
>
>
on myHandler(myList)
>
set myList to "a"
>
end myHandler
No no. The original writer stated that handlers deal with pointers to lists,
and thus to avoid the original list being altered, one must copy the list
inside the handler and deal with this copy. So my example shows that this is
not the case.