How is CLIM different?

This explanation was adapted from a comp.lang.lisp post by Robert Strandh.

Most programs using traditional GUI libraries are structured somewhat like this:

  1. Instances of different widgets with various options are created ;
  2. a geometry manager is used to lay them out ;
  3. events out bound to widgets ;
  4. an event loop is started.

But that structure is an unfortunate side-effect of the low level of those traditional GUI libraries. By having to handle events, you no longer have access to execution contexts such as the stack, and you have to manage all kinds of contexts yourself, or else you end up with applications that have a very rudimentary interaction policy.

CLIM turns the structure of traditional GUI libraries inside-out, and makes it both possible and normal to use interaction methods that are common in non-GUI based programs, i.e. where the program logic has the initiative, and you use reads and writes to accomplish the interaction.

CLIM has a "command loop" that is at a higher level than an event loop and that:

Writing a CLIM application therefore consists of:

  1. writing CLIM commands that modify the model independently of how those commands are invoked, and which may take application objects as arguments ;
  2. writing display routines that turns the model (and possibly some "view" object) into a collection of visible representations (having presentation types) of application objects ;
  3. writing completion routines that allows you to type in application objects (of a certain presentation type) using completions ;
  4. independently deciding how commands are to be invoked (menus, buttons, presentations, textual commands, etc).

By using CLIM as a mediator of command invocation and argument acquisition, you can obtain some very modular code indeed.

But there is more. CLIM is a well-documented and very rich collection of internal protocols, and programmers can add, modify, or replace components of CLIM by respecting those protocols, in particular the programmer can: