Next: , Up: expander specs   [Index]


15.9.1 Introduction to type specifications

The internal representation of object–types is as hierarchy of record–types having the type <object-type-spec> as base. The hierarchy of record–types is:

<object-type-spec>
   |
   +--> <core-type-spec>
   |
   +--> <struct-type-spec>
   |
   +--> <record-type-spec>
   |
   +--> <closure-type-spec>
   |
   +--> <compound-condition-type-spec>
   |
   +--> <union-type-spec>
   |
   +--> <intersection-type-spec>
   |
   +--> <complement-type-spec>
   |
   +--> <ancestor-of-type-spec>
   |
   +--> <pair-type-spec>
   |
   +--> <pair-of-type-spec>
   |
   +--> <list-type-spec>
   |
   +--> <list-of-type-spec> --> <alist-type-spec>
   |
   +--> <vector-type-spec>
   |
   +--> <vector-of-type-spec>
   |
   +--> <hashtable-type-spec>
   |
   +--> <enumeration-type-spec>
   |
   +--> <label-type-spec>
   |
    --> <interface-type-spec>

At present, all the record–types exposed by the library (vicare expander) are sealed: they cannot be sub–typed by user code.

The type <object-type-spec> has a field parent-ots that is used to represent the hierarchy of Scheme–level object–types.

All the built-in Scheme object types are represented by instances of <core-type-spec>; so <top>, <fixnum>, <string>, <list> et cetera are represented by instances of <core-type-spec>.

Hierarchy of list types

The hierarchy of list types is as follows:

<list>
   |
   +--> <null>
   |
   +--> (list-of ?type) --> <null>
   |
    --> <nelist> --> (list ?type0 ?type ...)

notice how <null> is considered a sub–type of both <list> and (list-of ?type) annotations, but not of (list ?type0 ?type ...); this special handling is implemented in the function object-type-spec.matching-super-and-sub?.

The type annotations (list-of ?type) are represented by instances of <list-of-type-spec>. (list ?type0 ?type ...) annotations are represented by instances of <list-type-spec>, and represent non–empty lists.

Hierarchy of vector types

The hierarchy of vector types is as follows:

<vector>
   |
   +---> <empty-vector>
   |
   +---> (vector-of ?type) ---> <empty-vector>
   |
    ---> <nevector> ----------> (vector ?type0 ?type ...)

notice how <empty-vector> is considered a sub–type of both <vector> and (vector-of ?type) annotations, but not of (vector ?type0 ?type ...) annotations; this special handling is implemented in the function object-type-spec.matching-super-and-sub?.

The type annotation (vector-of ?type) annotations are represented by instances of <vector-of-type-spec>. (vector ?type0 ?type ...) annotations are represented by instances of <vector-type-spec>, and represent non–empty vectors.


Next: , Up: expander specs   [Index]