Inform 7 Home Page / Documentation
Chapter 4: Kinds
§4.1. New kinds; §4.2. Using new kinds; §4.3. Degrees of certainty; §4.4. Plural assertions; §4.5. Kinds of value; §4.6. Properties again; §4.7. New either/or properties; §4.8. New value properties; §4.9. Using new kinds of value in properties; §4.10. Conditions of things; §4.11. Default values of kinds; §4.12. Values that vary; §4.13. Values that never vary; §4.14. Duplicates; §4.15. Assemblies and body parts; §4.16. Names made in assembly; §4.17. Postscript on simulation
Contents of Writing with Inform | |
Chapter 3: Things | |
Chapter 5: Text | |
Indexes of the examples |
§4.1. New kinds
Values are to Inform what nouns are to English sentences. They represent numbers, times of day, pieces of text, places, people, doors, and so on. Because they have such an enormous variety, and because we often want to talk about what some of them have in common, we need a way to sort all of these different ideas out. That's the main aim of Inform's concept of "kind".
Every value has a kind. The kind of 10 is "number"; the kind of 11:30 PM is "time"; the kind of "jinxed wizards pluck ivy from my quilt" is "text"; and so on. The Kinds index panel shows the kinds present in the current Inform project, which will always include a wide range of built-in kinds, and usually also some new ones created in that project.
Some kinds are more general than others. For example, if we write:
then Growler is an "animal", which is a kind of "thing", which is a kind of "object". When we talk about "the" kind of Growler, we mean "animal", the most specific one, but actually he belongs to all of those kinds.
As we see from this example, kinds have a whole hierarchy. Some are specialised versions of other kinds; some are not. Browsing the Kinds index shows that Inform builds its model world out of "objects". (That's really what objects are: "object" is a kind of value used to make the ingredients of the model world.) The objects fall into four fundamental kinds, "room", "thing", "direction" and "region", and "thing" is more subdivided still.
All the same, Inform starts out with a fairly simple arrangement. 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. Let's see how we might invent these new kinds. The easy one is:
Given that, we can then write:
That's easy enough. Adding "mammal" now looks awkward, though, because it seems to belong in between the two. All Bengal tigers are mammals, but not all animals are. But Inform can sort this out:
A mammal is a kind of animal. A Bengal tiger is a kind of mammal.
If we look at the Kinds index, we should indeed see a hierarchy:
though the diagram is laid out as a sort of tree, just as zoologists do.
As another example, it may seem curious that Inform doesn't usually think "man" is a kind of "animal". This is really because, in English, people don't usually expect something like "if an animal is in the garden" to be true when it's only the Revd Mr Beebe going for a walk. People expect the word "animal" not to mean a human being, despite our common genetic ancestry. But if we want to rearrange Inform's default ideas, we can do that quite easily:
Or indeed we could say:
A human being is a kind of mammal. A man and a woman are kinds of human being.
While this is an ideal way to make new kinds for the model world, we are more restricted in what we can do outside of objects. For instance,
isn't allowed. The numbers are fixed and all exist already; they aren't like Bengal tigers which we can simply imagine, and fill the world with. "Number" is not a concept we can specialise any further. But what we can do is to invent entirely new concepts, like so:
We will see more of these later. (This isn't specialising anything - "value" is a sort of everything-category, and is too big and vague to be a kind.)