Object-likeness
In many computer languages, values are things that you talk about. In AppleScript, values are things that you talk to. The following is a legal way to add 4 and 5 in AppleScript:
tell 4
get it + 5
end tellThe use of tell (we are addressing the number 4),
get (we are ordering the number 4 about), and
it (which means “whoever I am now
addressing”) shows the nature of the idiom. It is
not actually necessary to talk this way; one can add 4 and 5 by
saying something much simpler:
4 + 5
But this works because, behind the
scenes, AppleScript is supplying the tell and the
get for you, to make your life simpler. In
AppleScript, whether you know it or not, you are
always talking to some value and telling it to
do something.
One might therefore suppose that AppleScript is an object-oriented language and that all values in AppleScript are objects. Perhaps, one thinks, AppleScript will turn out to be like Smalltalk, where “everything is an object.” AppleScript also has certain values that are explicitly called “objects,” and refers to the datatypes of all values as “classes.” Plus, in a couple of areas AppleScript implements a kind of “inheritance” between one object (or class) and another. All of these things add to the impression that AppleScript might be object-oriented.
Personally, I remain doubtful as to whether AppleScript is really an object-oriented or even an object-based language. Apple’s own documentation says flatly that it is, but I’ve come to think of AppleScript ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access