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 (though no one in his right mind would actually talk like this) 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. To be sure, one can (and will) add 4 and 5 by saying something much simpler:
4 + 5
Yet this second way of talking works only 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. Plus, Apple's own documentation states flatly that it is.
Nonetheless, I remain skeptical. I don't think AppleScript is really object-oriented ...
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