A tale of two abstractions

Tagged as lisp, clim

Written on 2022-07-18 by Daniel 'jackdaniel' KochmaƄski

I've been recently thinking about how McCLIM should be structured and I've came up with the following diagram:

-- System ----------------------------------------------------

Operating System Interface (portability layers, ...)
Utilities (portable lisp utilities)
Geometry and Math abstractions (regions, matrices, graphs)

-- Silex -----------------------------------------------------

Output Facilities         >    Stream Output Protocol
Windowing Substrate       >    Stream Input Protocol

-- Frame Manager -------- > -- CLIM Stream Pane---------------

Panes                     >    Typed output, Input editing
Gadgets                   >    Menu and Dialog facilities
Application Frames        >    Command Processing

There are three major layers:

  1. System: UI-agnostic utilities
  2. Silex: low-level and stream protocols for I/O
  3. Frame Manager: graphical and semantical toolkits for UI

Both layers "Silex" and "Frames" have two columns.

The left column represents contemporary abstractions for user interfaces:

  • the low level abstraction for windowing (cf. X11 and SDL2)
  • the graphical toolkit (cf. GTK and QT)

The right column represents "Lispy" abstractions for user interfaces:

  • the stream abstraction for windowing
  • the semantical toolkit


Dependencies go "right-bottom", that is each protocol depends on all things defined above it and to the left. That means in particular, that to use a "contemporary" toolkit there is no need to depend on the "semantical" one, i.e:

  • "Application Frames" depends on "Gadgets"
  • "Command Processing" depends on "Application Frames" and "Dialog Facilities"

It may be tempting to mix abstractions and it is supported, but it is important to keep in mind the difference - the graphical toolkit runs "in" the event loop while the semantical toolkit "in" the command loop (built on top of the former).

Writing backends

Generally backends belong to the layer "Silex". Drawing backends should depend on the protocol "Stream Output Protocol" while interactive backends the protocol "Windowing Substrate". Additional refinements may be implemented by specifying a custom "Frame Manager" (i.e to provide a different set of panes and gadgets).

The system "silex" is meant to provide a common base for all kinds of toolkits.

Closing remarks

This architecture is a conceptual model that is meant to make things more intelligible. CLIM II specification is a large document and many users have problems with making sense of it.