| Chapter 21: Extensions |

| 21.16. Types are not kinds of value

I7 has an extensive system of checking to determine whether any given value makes sense in a particular context. For example, it will not allow "the capacity of the basket" to be used where text is expected, since it is ultimately a number. This is called type-checking, and the language is complicated enough that there are over 50 different types built into Inform. Some of these are nameless and are used purely inside the Inform software. The remainder are catalogued in the next section.

Even though there are still over 30 types which have names, relatively few of these names will ever be known to, or needed by, the user of I7. For instance, the exotic type "table-column" (exotic types often have hyphenated names) exists only so that the Standard Rules can make definitions like this one:

> To sort (T - table-name) in (TC - table-column) order:
> (- TableSort({T}, {TC}, 1); -).

Here two exotic types are used. One, "table-name", was in fact briefly mentioned in the chapter on Tables, but the other, "table-column", is never explicitly described in this documentation.

In general, the "exotic" types not previously described in the documentation have been omitted for a reason. They cannot be stored in variables with "let" and will not always be allowed even in phrase definitions unless the phrase is defined using I6, like the sorting example above. It is safest to use them as little as possible, and to make no assumptions that they are bound to follow the pattern of what other I7 constructions seem to do.

For instance, "unicode-character" does not behave like "number": it is a concept used in text recognition, not a kind of value. Similarly, "condition" is not a Boolean true/false value but is a label applied to a sequence of words to identify it as describing a state of affairs which might or might not be true. And "action", although it is the type of actual data, is a collection of information too large to be held in any single value. It therefore makes no sense to have a variable whose type is any of these, the first two being conceptually impossible, the third impracticable.

Previous | Contents | Next