[WIP] Klee: A Language for Describing Shapes

The problem: We have an actor that has a rich internal model of some domain, and we want to use this model to generate a graphic design and render it to the user, how do we do this?

The (overly-simplified) answer: We build another actor!!!!1! Which listens for descriptions of shapes, and draws them to the screen. Now our original actor can make assertions of shapes, and the receiving actor will draw these descriptions.

For now I am calling this shape description language “Klee”. It is a programming language that will likely fall into the DOMain of shadows issue. But nonetheless I will try to make it a useful tool for using from any Syndicate implementation. It is roughly a mashup of ideas taken from the world of “display servers”, specific examples include:

The fundamental idea of Klee is that today’s vector graphics are highly dynamic. Take, for example, a graphic designer from the print-era, they would create a design for a single document size which gives the designer incredible control over the layout and parameters of their creation. Compare this to the modern website front-end designer, who needs to make a coherent design that is appropriate for screen widths of ~250px continuously to over 2000px, on all sorts of aspect ratios. The modern front-end designer no longer is constructing a design, but instead they are constructing a program to build a design given an arbitrary screen dimension. I figure creating a programming language for the definition of these “parameterized shapes” could be an appropriate tool for modern graphic design.

A Note on Naming

Because the “shapes” we are working with greatly stretch the definition of what people commonly refer to as shapes. I want to move towards calling these descriptions “morphs”. This also gives us the snazzy term “metamorph” for describing what we previously labeled “parameterized shapes”.

A Note on Syntax

Klee programs are not passed around as text representation. They are passed around purely as preserves structures that represent their AST and are serialized and deserialized per the preserves spec. As such, any recommended Klee editors should ideally work by making direct edits to the AST of the program, and not via some inhumane text representation.

In what world would it make sense to edit a highly structured AST using some bizarre text format?

Anyways, now that we got that out of the way, the Klee examples on this page will use a lisp syntax as it’s simpler for me than creating an AST to HTML converter to properly display programs.

A Basic Klee Program

(define (my-square)
  (square :side-length 20))

(view (my-view)
  `(:width 50 :height 50)
  (box-layout
    my-square
    my-square))