Reference variables
Reference variables
- Subject: Reference variables
- From: Nigel Garvey <email@hidden>
- Date: Sun, 14 Jan 2001 02:10:59 +0000
Could someone please clarify my understanding of the low-level workings
of reference variables?
1) What exactly *is* a reference variable (as set by the 'a reference to'
operator) physically? Is it a set of AppleScript tokens, some sort of
superpointer, or what?
2) How does its application to large items (such as the bigList example
on p.205 of the 1999 ASLG) achieve such spectacular speed increases? What
are the mechanics?
3) What happens in the last line of this script?
set bill to missing value
set fred to a reference to bill
--> bill of +script;
set arthur to a reference to text 1 thru 8 of fred
--> text 1 thru 8 of bill of +script;
set sid to a reference to character 4 of arthur -- (no-one on this
list...)
--> character 4 of text 1 thru 8 of bill of <<script>>
set bill to "1234567890"
set charlie to contents of sid --> "4"
sid is a complete reference in its own right (so you can subsequently
change fred or arthur without affecting its connection with bill). When
its contents are accessed, is every part of it then called into
existence, including the intermediate string "12345678"?
NG