Chapter 4: Kinds
4.12. Values can have properties too

Thinking about Inform as a language, we've seen two different sorts of noun: objects - including things, rooms, doors, people, animals, and so on - and values, such as numbers, brightnesses and the like. Objects are intended to simulate actual physical things in the model world we create, whereas values are more abstract. Philosophers could argue about quite a lot of borderline cases - is "northeast" a physical thing? (Inform says yes.) But it's mostly a useful distinction. Inform provides slightly different facilities for handling objects than it does for handling values, because we usually have different needs for them.

There are some differences which can't be ignored. For instance, maybe there are 80 people in the model world, maybe just one person: but there are infinitely many numbers. And we can just conjure up new people, but we can't conjure up new numbers.

But not all kinds of value are like "number": often, they behave more like objects, and then we can treat them the same way, too. To go back to the "brightness" example, suppose we have set things up with:

Brightness is a kind of value. The brightnesses are dim, shining, and blazing.

These are values, but we can create them freely, giving each of them names, just as we do with objects. And we could then add:

A brightness can be adequate or inadequate. A brightness is usually adequate. Dim is inadequate.

Maybe this could represent whether the amount of light is enough to read by, for instance. Just as open/closed is an either-or property for doors, which are objects, now adequate/inadequate is an either-or property for brightnesses, which are values. And values, just like objects, can also have value properties of their own:

A brightness has a number called temperature. The temperature of blazing is 140. The temperature of shining is 110. The temperature of dim is 70.

Now temperature is a numerical property of a brightness, which is a value, in just the same way that carrying capacity is a numerical property of a container, which is an object.

Not every value can have properties, though, for basic reasons of practicality. For instance, we can't write:

A number can be fun or boring.

There are just too many numbers for Inform to store this much information. That doesn't mean we can't have adjectives to describe numbers - on the contrary, Inform has adjectives like "odd" and "even" built in, as we shall see later. But properties need storage space, because they represent information which can change unpredictably during play, and that does impose limits. (The Kinds index of any project has a useful chart showing the different kinds of value which exist, and what can be done with them.)


PreviousContentsNext