Sometimes, a diagram can say more than a thousand lines of code. But, sadly, most
of the time, software engineers give up on diagrams after the design phase, and all
real work is done in code. The supremacy of code over diagrams would be leveled if
diagrams were code. This paper suggests that model and instance diagrams, or, which
amounts to the same, class and object diagrams, become first level entities in a
suitably expressive programming language, viz., type theory. The proposed semantics
of diagrams is compositional and self-describing, i.e., reflexive, or metacircular.
Moreover, it is well suited for metamodelling and model driven engineering, as it
is possible to prove model transformations correct in type theory. The encoding
into type theory has the additional benefit of making diagrams immediately useful,
given an implementation of type theory.