DekGenius.com
[ Team LiB ] Previous Section Next Section

Chapter 13. Datatypes

A datatype is a classification of a value; every value is of one datatype or another. This is what AppleScript calls a class (see Chapter 10). For example, string is a datatype, integer is a datatype, and so forth. AppleScript provides a number of native datatypes; this chapter describes them.

Scriptable applications can extend the language by providing additional datatypes. For example, the Finder implements a folder datatype (or class). But such additional datatypes are confined to the application that defines them; a value returned by a scriptable application must be either a reference to an object belonging to that application, or one of AppleScript's native datatypes.

Some values can be mutated from one datatype to another. Such a mutation is called coercion . To put it more strictly: for some pairs of datatype, call them datatype 1 and datatype 2, it is the case that at least some values of datatype 1 can be coerced to a value of datatype 2. For example, the string "1" can be coerced to a number; when that happens, you get the number 1. What coercions are possible, and how they are performed, is explained in Chapter 14 and Chapter 15.

    [ Team LiB ] Previous Section Next Section