Re: set variables, in mass
Re: set variables, in mass
- Subject: Re: set variables, in mass
- From: kai <email@hidden>
- Date: Wed, 1 Dec 2004 04:14:58 +0000
On Wed, 1 Dec 2004 12:26:03 +1100, "halloolli" wrote:
set a to 0 -- a now has 0
copy a to b -- b now has 0
is there any difference between set and copy?
In some circumstances - particularly those relating to lists, records
and script objects, where data sharing may be involved.
Compare these results:
============
set x to {1}
set y to x
set x's item 1 to 10
x - y
--> 0
------------
set x to {1}
copy x to y
set x's item 1 to 10
x - y
--> 9
============
- or these:
============
set x to current date
set y to x
set x's year to 2005
x - y
--> 0
------------
set x to current date
copy x to y
set x's year to 2005
x - y
--> 31536000
============
Details of the differences between set and copy, along with an
explanation of data sharing, can be found in the AppleScript Language
Guide (ASLG):
Set:
http://developer.apple.com/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/AppleScript.75.html#10267
Copy:
http://developer.apple.com/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/AppleScript.66.html#21248
Data Sharing:
http://developer.apple.com/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/AppleScript.9a.html#23480
In spite of a lack of recent updates, the ASLG is still - IMO - a
document well worth reading and keeping to hand:
HTML:
http://developer.apple.com/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/index.html
Download PDF:
http://developer.apple.com/documentation/AppleScript/Conceptual/
AppleScriptLangGuide/AppleScriptLanguageGuide.pdf
(The latter may appear to merely open a blank browser window - in which
case check your Downloads window.)
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden