When you set one variable to another, they both point to (or contain) the same object. If the object is some kind of container or structure (list, record, or date) and you change its contents, you’ll see the changes whichever variable you use to look at it.
When you set the variable to something else ” such as the result of extracting all the items of class ‘item’ from the list ” you get a different list. However, this list contains the same physical items as the first. You can put different items in one list and the other list will remain as it was. But it any of the items are themselves containers, and you simply change their contents, you’ll see the changes in both lists.
set theList to {"Dog", "Cat", "Fish", {"Aardvark"}}
set copyList to the items of theList
set item 1 of copyList to "Horse"
return theList --> {"Dog", "Cat", "Fish", {"Aardvark"}}
-- But:
set theList to {"Dog", "Cat", "Fish", {"Aardvark"}}
set copyList to the items of theList
set item 1 of item 4 of copyList to "Horse"
return theList --> {"Dog", "Cat", "Fish", {"Horse"}}
When you copy one variable to another, structural objects are duplicated. What McUsr refers to as a “deep copy” means that every structure within the structure is duplicated, not just the top-level item. You can thus change anything at all within one structure without affecting anything in the other:
set theList to {"Dog", "Cat", "Fish", {"Aardvark"}}
copy theList to copyList -- Duplicate the entire structure.
set item 1 of item 4 of copyList to "Horse"
return theList --> {"Dog", "Cat", "Fish", {"Aardvark"}}
I don’t know what McUsr means by copying “the surrounding environment” and “if it is a global property”. A “deep copy” is the duplication of the internal structure. Only variables have scope. Copy and set work on values, which don’t.