Language Guide

CHAPTER 3
Values
60 Value Class Denitions
COERCIONS SUPPORTED
The application to which an object specified by a reference belongs determines
whether the value of the object can be coerced to a desired class.
NOTES
A reference can function as a reference to an object or as an expression whose
value is the value of the object specified in the reference. When a reference is
the direct parameter of a command, it usually functions as a reference to an
object, indicating to which object the command should be sent. In most other
cases, references function as expressions, which AppleScript evaluates by
getting their values.
For example, the reference in the following example functions as a reference to
an object. It identifies the object to which the Copy command is sent.
copy word 1 of front document of application "Scriptable Text Editor"
On the other hand, the reference in the following example functions as a
reference expression:
repeat (word 1 of front document of application
"Scriptable Text Editor") times
display dialog "Hello"
end repeat
When AppleScript executes the statement, it gets the value of the reference
word 1 of front document of application "Scriptable Text
Editor"—a string—and then coerces it to an integer, if possible. (For
information about the Repeat statement, see “Repeat Statements,” which
begins on page 194. For information about coercions, see “Coercing Values” on
page 68.)