• 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: 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


  • Follow-Ups:
    • Re: copy & set statements
      • From: Chris Page <email@hidden>
    • Re: copy & set statements
      • From: Timothy Bates <email@hidden>
  • Prev by Date: Re: copy & set statements
  • Next by Date: Re: Eudora: sending to more than 50 recipients
  • Previous by thread: Re: copy & set statements
  • Next by thread: Re: copy & set statements
  • Index(es):
    • Date
    • Thread