I was thinking about using numbers to represent types. If a type is derived from another, then the subclass would be a smaller number. An instance of a type would store its data in the fraction of the type. Two types could be checked for compatibility by bit-masking them.
You could then create a type library for application that would be all in a range of numbers.
An array of a type would be a special type that would contain the size and the element type as smaller data parts of the number. The same for a pointer type.