• 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: Creating list references in handlers. Bad code or bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating list references in handlers. Bad code or bug?


  • Subject: Re: Creating list references in handlers. Bad code or bug?
  • From: Victor Yee <email@hidden>
  • Date: Sat, 15 Sep 2001 10:20:47 -0400

On Sat, 15 Sep 2001 15:29:38 +0200, Helmut Fuchs wrote,

> At 8:04 Uhr -0400 15.09.2001, Victor Yee wrote:
> >Was thinking about this and I believe that there is an implicit
> >"get" involved here.
>
> Never looked at this from that perspective... but even though it
> looks like it works - it's not a reference you're having there.
>
> If you run the following, you'll see what I mean:
>
[...]

I think that your test has to do more with "contents of" rather than data sharing:

on theHandler()
local theData, notRealListReference, realListReference, theData1

set theData to {theList:{"unchanged!"}}

set notRealListReference to a reference to (get theList of theData)

set realListReference to a reference to theList of theData

set item 1 of contents of realListReference to "changed!"

return notRealListReference
end theHandler

theHandler()

--> {"changed!"}
>
> By using 'get' one ends up working with a _copy_ of the original data
> (at least in the above case). Whereas without the 'get' you can make
> use of data sharing.

This seems to show that data sharing does occur. I suspect that perhaps there is an issue with the level of referencing that occurs ("contents of" will usually dereference by one level).

Victor

p.s. I'm starting to get confused again. Can we move this discussion to script objects? ;)


  • Prev by Date: Re: Creating list references in handlers. Bad code or bug?
  • Next by Date: Re: Creating list references in handlers. Bad code or bug?
  • Previous by thread: Re: Creating list references in handlers. Bad code or bug?
  • Next by thread: Re: Creating list references in handlers. Bad code or bug?
  • Index(es):
    • Date
    • Thread