• 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: when to use "copy" vs "set" [was Re: Manipulating text]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: when to use "copy" vs "set" [was Re: Manipulating text]


  • Subject: Re: when to use "copy" vs "set" [was Re: Manipulating text]
  • From: "Mark J. Reed" <email@hidden>
  • Date: Sat, 26 Sep 2009 18:50:44 -0400

On Sat, Sep 26, 2009 at 3:12 PM, has <email@hidden> wrote:
> If you're coming from a C background, I suggest you ignore the extra twist
> regarding the way that AS integers are represented internally, and just
> think of all AppleScript objects as heap-allocated structs.

Right. From the semantics, it may seem as though sometimes you're
assigning structs and sometimes you're assigning pointers to structs,
but logically they're all "pointers".  The behavioral difference is
entirely down to the immutability: when you apply an operation to a
number or a string, it always creates a brand new number or string.
But there are some modifications you can apply to a list or record or
an application object that change the existing one in place instead.

So aliasing numbers or strings is harmless - they'll never change out
from under any of the pointers to them.  But aliasing lists and
records and other objects is another matter.


--
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: when to use "copy" vs "set" [was Re: Manipulating text] (From: has <email@hidden>)

  • Prev by Date: Add Printer via UI scripting
  • Next by Date: Re: AS Application
  • Previous by thread: Re: when to use "copy" vs "set" [was Re: Manipulating text]
  • Next by thread: AS Application
  • Index(es):
    • Date
    • Thread