Clouseau – The McCLIM Inspector

Jan Moringen (scymtym on IRC)

Agenda

Goal: Introduce and demonstrate Clouseau, mainly from a user's perspective.

  1. Background
    • Inspector
    • Names
    • Brief History
  2. (Re)Design
    • Requirements
    • Architecture
  3. Demos
    • Basics
    • Specialized Visualizations and Operations
    • Updating
    • Customization
  4. Problems and Future Work

Background

Names: CLIM, McCLIM, Clouseau

CL (Common Lisp)
An ancient interpreted programming language that nobody uses. Also in desperate need of a revised standard.
CLIM (Common Lisp User Interface Manager)
A specification describing a set of protocols for building graphical interactive applications.
McCLIM
mcclim-logo.png One implementation of the CLIM specification.
Clouseau (a.k.a. "The Inspector", "Inspector Clouseau")
inspector-clouseau.jpeg Two CLIM-based inspectors included in the McCLIM codebase: the original one and a completely rewritten version.

Inspector

Wikipedia entry for "Inspector Window" (emphasis mine)

The graphical control element inspector window is a type of dialog window that shows a list of the current attributes of a selected object and allows these parameters to be changed on the fly.

For "Inspector" instead of "Inspector Window", I would amend:

  • It can inspect any value (not just a selected object) and navigate related values
  • It indicates the kinds or types of inspected values
  • It does not have to be graphical
  • Can make more fundamental changes than changing parameter values

Brief History: Inspector in Genera

screenshot-genera-inspector.gif

Source: http://www.ifis.uni-luebeck.de/~moeller/symbolics-info/development-environment/index.html

Brief History: cl:inspect

* (inspect climi::*all-ports*)
The object is a CONS.
0. CAR: #<MCCLIM-TRUETYPE::CLX-TTF-PORT :HOST "" :DISPLAY-ID 1 {1006ED6E13}>
1. CDR: NIL
> 0
The object is a STANDARD-OBJECT of type MCCLIM-TRUETYPE::CLX-TTF-PORT.
0. SERVER-PATH: (:CLX-TTF :HOST "" :DISPLAY-ID 1 :SCREEN-ID 0 :PROTOCOL :LOCAL)
1. PROPERTIES: NIL
2. GRAFTS: (#<CLIM-CLX:CLX-GRAFT {100AE29743}>)
3. FRAME-MANAGERS: (#<CLIM-CLX::CLX-FRAME-MANAGER {1006EDC6C3}>)
4. SHEET->MIRROR: #<HASH-TABLE :TEST EQ :COUNT 1 {1004EC7283}>
5. MIRROR->SHEET: #<HASH-TABLE :TEST EQ :COUNT 1 {1004EC7313}>
6. PIXMAP->MIRROR: #<HASH-TABLE :TEST EQ :COUNT 0 {1004EC73A3}>
7. MIRROR->PIXMAP: #<HASH-TABLE :TEST EQ :COUNT 0 {1004EC7433}>
8. EVENT-PROCESS: #<SB-THREAD:THREAD "#<MCCLIM-TRUETYPE::CLX-TTF-PORT :HOST \"\" :DIS…
9. LOCK: #<SB-THREAD:MUTEX "port lock" (free)>
10. TEXT-STYLE-MAPPINGS: #<HASH-TABLE :TEST EQ :COUNT 4 {1004EC74E3}>
11. POINTER-SHEET: #<CLIM-CLX::CLX-784-TOP-LEVEL-SHEET-PANE CLOUSEAU:INSPECTOR {100B7…
12. GRABBED-SHEET: NIL
13. MIRRORED-SHEET->CURRENT-POINTER-CURSOR: #<HASH-TABLE :TEST EQ :COUNT 0 {1004EC757…
14. SELECTIONS: #<HASH-TABLE :TEST EQL :COUNT 0 {1004EC7603}>
⋮

Brief History: The SLIME Inspector

screenshot-slime-inspector.png

Brief History: The Original Clouseau

screenshot-first-clouseau.png

Brief History: The Rewritten Clouseau

screenshot-clouseau.png

(Re)Design

Requirements and Goals

  • Visualize values
    • Nested values and multiple values at once
    • Relations between values
    • Indicate kind or type
    • Handle multiple occurrences well (including circular structure)
    • Take full advantage of graphical capabilities
  • Navigate
    • Search
    • Zoom/Expand/Visit
    • History of visited values
  • Update view when value changes
  • Manipulate
    • Offer suitable operations based on value type and its context

Key Difference: First-class Places

First Clouseau
Parent value → Child value
Second Clouseau
Parent value → First-class place → Child value
screenshot-clouseau-places.png
screenshot-first-clouseau.png

New Architecture

architecture.png
  • Values are not stored
  • Specialized places and object states

More details in Apps/Clouseau/DESIGN.org.

Demos

Demo: Basics

  • Window Layout
    • Show/hide interactor
  • Navigation
    • Expand/Collapse
    • Visit and History
  • Evaluate in context

Documentation https://common-lisp.net/project/mcclim/static/manual/mcclim.html#Inspector

Demo: Specialized Visualizations

  • Occurrences
  • Numbers:
    • Integer
    • Double
    • Complex
  • Hash-table
  • Class
  • Array
  • Lists
    • As graph
    • Dotted, Alists, Plists
  • Color and McCLIM-specific value types

Demo: Specialized Operations

  • Functions
    • Trace
    • Show Disassembly
  • Instance
    • Change class
  • Adjustable vector
    • Place drag and drop
    • Remove value of place

Demo: Update

(defvar *inspector* (nth-value 1 (clouseau:inspect #C(1 2) :new-process t)))

(loop :for i :from 0 :to (* 2 pi) :by .1
      :do (setf (clouseau:root-object *inspector* :run-hook-p t)
                (complex (cos i) (sin i)))
          (sleep .1))

Demo: Customization

(defmethod clouseau:inspect-object-using-state ((object asdf:system)
                                                (state  clouseau:inspected-instance)
                                                (style  (eql :expanded-body))
                                                (stream clim:extended-output-stream))
  (clim:format-graph-from-root
   object
   (lambda (node stream)
     (clouseau:formatting-place (object 'clouseau:pseudo-place node nil present)
       (present stream)))
   (lambda (object)
     (map 'list #'asdf:find-system
          (remove-if-not #'atom (asdf:system-depends-on object))))
   :stream stream :merge-duplicates t :maximize-generations t)
  (call-next-method))

More details in https://common-lisp.net/project/mcclim/static/manual/mcclim.html#Extending-Clouseau

Problems and Future Work

Disadvantages compared to SLIME's Inspector

  • Unusable without mouse
    • Commands can be typed but selecting presentations can (currently) only be done using the mouse
  • There is no usable (i)search
  • No Emacs integration (but debugger and listener integration)

Future Work

  • Make presentations selectable via keyboard shortcuts

    Prototype

  • Implement double-buffering in McCLIM

    Prototype

Thank You

Thank you for your attention!

McCLIM

IRC Channel
#clim on freenode
Code
https://github.com/McCLIM/McCLIM
Documentation
https://common-lisp.net/project/mcclim/static/manual/mcclim.html

Clouseau

Code
https://github.com/McCLIM/McCLIM/tree/master/Apps/Clouseau
Documentation
https://common-lisp.net/project/mcclim/static/manual/mcclim.html#Inspector