Re: Scope of globals, parents and children, "load script" and all that
Re: Scope of globals, parents and children, "load script" and all that
- Subject: Re: Scope of globals, parents and children, "load script" and all that
- From: Sander Tekelenburg <email@hidden>
- Date: Tue, 22 May 2001 18:10:08 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 03:44 +0200 UTC, on 21/05/2001, Brennan Young wrote:
>
Sander Tekelenburg <email@hidden> wrote
>
>
> Brennan Young wrote :
[...]
>
> [...] I would like to simply say something
>
> like:
>
>
>
> get myName of DoStuff() of myObject
>
>
Well, that syntax should work if myObject looked like this:
>
>
script myObject
>
on DoStuff()
>
return {var1 : "hello", myName : get computer name}
>
end DoStuff
>
end script
Ah yes, of course. Use records.
[...]
[Explanation of "datatypes that are passed by reference, rather than by
value"]
[...]
>
[...] The 'copy' command is designed to give us a unique copy of data which
>
might otherwise be passed 'by reference':
>
>
set l to {1, 2, 3}
>
copy l to m -- second copy of the original list
>
set item 1 of l to 99 -- does not affect m because it's a different list
>
>
get m -- returns {1, 2, 3}
>
>
So you can use objects which are passed by reference, such as lists,
>
records or script objects, to make data available to various places without
>
making it global.
Got it. Thanks!
[...]
>
> > Using instances is another great way to think out of the box of using
>
> > globals. I suspect that many Applescripters are not using instances
>
> > much, or at all.
>
>
>
> I wouldn't know if I use them. What *is* an "instance"? :)
>
>
Now we're getting into some really heavy stuff.
Indeed. I'm going to leave that for later then :)
[...]
[parent & child - who is who]
>
> [...] Could/should the
>
> user-launched applet be the child, and load its parent (through "property
>
> parent : load script [alias]")?
>
>
Absolutely!
Aha! That certainly clears things up :)
Thanks a lot! I think I am about ready to give this a try.
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <
http://www.pgp.com>
iQA/AwUBOwqPXOsywKfXgqKdEQKo4QCdHIpyCin5ZoRRsJXoidjQWpfrA88An3Ev
id9sm/x7axLmiD+GTD7Ae3hz
=xGbe
-----END PGP SIGNATURE-----
--
Sander Tekelenburg, <
http://www.euronet.nl/~tekelenb/>
Mac user: "Macs only have 40 viruses, tops!"
PC user: "SEE! Not even the virus writers support Macs!"