Re: copy & set statements
Re: copy & set statements
- Subject: Re: copy & set statements
- From: email@hidden
- Date: Tue, 23 Oct 2001 19:11:22 -0400
On Tue, 23 Oct 2001 23:42:46 +1000
Timothy Bates <email@hidden> asked,
>
On 23/10/01 11:08 PM, "Nigel Garvey" <email@hidden>
>
wrote:
>
> on myHandler(myList)
>
> set item 1 of myList to "a" -- make a change within the list
>
> end myHandler
>
>
>
> set theCat to {"woody", "hungry"}
>
>
>
> myHandler(theCat)
>
> return theCat
>
>
>
> -->>{"a", "hungry"}
>
>
Demonstrating that, indeed, handler parameters ARE passed as pointers and
>
others as values. Geeze, that is a really bad inconsistency in the
>
language, and one of which I was unaware.
Actually, everything is passed as a pointer, but because AppleScript coerces
almost everything invisibly, the pointerness of simple values isn't apparent.
Also, only lists and records have ways of doing things to the actual object
(like "set end of myList to 42" or "set p of r to 12"). With simple values, like
numbers or strings, you don't have the ability to reach in and change part of
them; its either all or nothing, and if you change all of the value, you can't
tell whether you have a new value or if you've just changed the old one.
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden