Read Only Language

The complement to a WriteOnlyLanguage. A language where working programs are obvious in their intent, but unexpectedly difficult to construct.


A term often applied to (for example) AppleScript. When Applescript was originally designed, MacOs only used CooperativeThreading, which put a very large latency cost on inter-process communication. To fight this, Applescript was designed to send very high level commands to targeted programs. So, rather than asking for an interface to a collection of objects, then asking for the third element, a single AppleEvent? would bundle up both the object and the concept of "third". The AppleEventObjectModel went as far as supporting a kind of ListComprehension, which was exposed in Applescript syntax as expressions involving "every/each", "where/whose", and associated relational tests. When it worked well, it leads to compact yet readable code like this:

tell application "Finder"
    set f to folder "Documents" of home
    set my_list to every item of f whose name starts with "A"
end tell

The downside of this approach was that implementing the high level semantics of the AppleEvent? model was left up to the recipient of the event. For example, the Finder must be able to get a collection of "items" from a folder reference, implement the "whose" message on a collection of "items", and the implementation must support the "starts with" clause -- all from unpacking one AppleEvent?. Most target applications fall short of a complete implementation, and no two fell short in the same way.

The experience of writing AppleScript was one of writing the program you want to write, discovering that some message is not supported by the object you're targeting, then rewriting to avoid using that type of event -- for example, if you discover you cannot access an object by name, you fall back on retrieving the list of object references and then write a loop querying each one's name in turn.

Now that MacOsx programs are largely written in ObjectiveCee, it is reportedly much easier to wire up a standard AppleEvent? interpreter to an application's object model.


EditText of this page (last edited October 1, 2012) or FindPage with title or text search