| Chapter 4: Kinds |

| 4.1. New kinds

Everything has a kind: but kinds can have more specific kinds. Inform makes the world out of three fundamental kinds of object, "room", "thing" and "direction": but, browsing the Kinds index, we find a dozen or so kinds built into Inform. For instance, "container" is a kind of "thing", and "woman" is a kind of "person" which is in turn a kind of "thing". The character "Elizabeth" might be a "woman", and we call this her kind since it is her most specific attribute, even though she is also a "person" and indeed also a "thing". Everything with physical existence in Inform's model world has a kind.

Because taxonomy - setting up kinds for everything - is so difficult, and depends so much on what you want it for, Inform creates relatively few kinds in advance: it has "animal" built in, but not "mammal" or "Bengal tiger". When we need more, we must make them ourselves.

Any new kind must be created as a special case of an existing one. Here we sub-categorise rooms:

> A dead end is a kind of room.

Any dead end that we make is also a room, but can also have other properties in addition, if we so decide. Recall that some rooms are "dark", meaning that there is no light present unless something "lit" is visible.

> A dead end is a kind of room with printed name "Dead End" and description "This is a dead end. You'll have to go back the way you came." A dead end is usually dark.

> The Undertomb is a dark room. East is a dead end. South is a dead end with printed name "Collapsed Dead End". Northwest is a dead end called the Tortuous Alcove.

> In the Undertomb is the candle lantern. It is lit.

Three different rooms adjoin the Undertomb as a result. Notice how much more concise this is thanks to having the "dead end" kind to hand.

For the most part, Inform does not mind in what order it is told about the world, but it may need to know the name of a kind before that kind can be used. For example,

> A coffer is a kind of container. In the Crypt is an open coffer.

makes sense to Inform and results in the creation of a new thing, just called "coffer" in the absence of any other name to give it, whose kind is "coffer" and which is initially open. Whereas if Inform reads:

> In the Crypt is an open coffer.

when it does not know that "coffer" is a kind, it simply makes a thing called "open coffer" and which has no containment properties. Inform has to be careful like this: English is simply too overflowing with multiple meanings. (An "open railway ticket", for instance, is not a "railway ticket" that one can put objects into.)

What is a kind, really? In the end it is a name for a bundle of properties, and the key differences between a kind (such as "container") and a property (such as "fixed in place") are that, firstly, something only has one kind (except in the sense that a container is also a thing, and so on), and secondly, it has that kind forever, whereas properties may change.

Previous | Contents | Next