• 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: A reference to problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A reference to problem


  • Subject: Re: A reference to problem
  • From: Paul Skinner <email@hidden>
  • Date: Mon, 04 Jun 2001 15:33:59 -0400

on 6/3/01 7:47 AM, Serge Belleudy-d'Espinose wrote:

> Hi all,
>
> As seen in the ASLG, I would like to take the benefit of one such construct:
>
>> repeat with i from 1 to 1000
>> set xList's end to i
>> end repeat
>>
>> set rxList to a reference to xList
>>
>> repeat with i from 1 to 1000
>> rxList's item i
>> end repeat
>
> Oh oh, this is fa-a-a-st :)
>
> But once inside a handler, the line 'rxList's item i' gets me
>
> -- Can't get item 1 of xList.
>
> ???
>
> Ok, I understand this is a kind of scope problem.
> I can use 'global xList' anywhere inside or outside the handler, but this is
> obviously not what I want.
> None of the my/of me/'s I tried did work.
> rxList is 'xList of <<script>>', but I cannot get the class of it. Who is
> script?
>
> I'm stumped.

Did you try supplying the list reference directly to the handler in it's
parameters?

set theList to {"the ", "values ", "you ", "want"}
-->{"the ", "values ", "you ", "want "}
set listRef to a reference to theList
-->theList of +script;

doStuffWithList(listRef)
-->"the values you want."

on doStuffWithList(aList)
return (every item of aList as string) & "."
end doStuffWithList

--
Paul Skinner


References: 
 >A reference to problem (From: "Serge Belleudy-d'Espinose" <email@hidden>)

  • Prev by Date: Prepare an attachment on Eudora
  • Next by Date: Re: [OFF] Filename encoding on the net
  • Previous by thread: A reference to problem
  • Next by thread: Re: A reference to problem
  • Index(es):
    • Date
    • Thread