Language Guide

CHAPTER 4
Commands
Command Denitions 117
NOTES
If you use the Set command to set a variable to a list, record, or script object, the
variable shares data with the original list, record, or script object. If you change
the data of the original, the value of the variable also changes. Here’s an
example of how this works:
set myList to { 1, 2, 3 }
set yourList to myList
set item 1 of myList to 4
The result of these statements is that item 1 of both myList and yourList is 4.
Data sharing promotes efficiency when using large data structures. Rather than
making copies of shared data, the same data can belong to multiple structures.
When one structure is updated, the others are automatically updated.
IMPORTANT
To avoid data sharing for lists, records, and script objects,
use the Copy command instead of the Set command.
Only data in lists, records, and script objects can be shared; you cannot share
other values. Moreover, you can share data only on the same computer, and the
shared structures must all be in the same script.