Resolution Difficulties

Having sketched a basic picture of how terminology is resolved, we can proceed to cover various complications that occasionally arise.

Conflict Resolution

Terms are sought in the dictionaries of the innermost application, of AppleScript itself, and of all scripting additions, as well as in the script. Given such a large namespace involving multiple independent entities, it is possible for conflicts to arise. Such a conflict is called a terminology clash. Either the programmer generates the clash by an unwise choice of variable names, or different dictionaries generate it by defining the same term in different ways.

Clash caused by the programmer

When the programmer causes a terminology clash, various things can happen. Sometimes the code won’t compile; sometimes it won’t run; sometimes it runs but gets an unexpected result; sometimes the clash is resolved sensibly and there’s no problem.

When the compiler stops you from using a term, it is generally because the term is defined elsewhere as a certain “part of speech” and you’re trying to use it in a different way. For example, this won’t compile:

local container
tell application "Finder" to set container to 7 -- compile-time error

Within the context of a tell directed at the Finder, container is resolved as the Finder’s term container, which is a class name; that’s not something that can be assigned to, so the compiler balks.

You may be wondering what happened to rule 1 under Section 19.1.2.2. Rule 1 didn’t ...

Get AppleScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.