25.20. Inform 6 objects and classes

| Chapter 25: Extensions |

| 25.20. Inform 6 objects and classes

As might be expected, I7 compiles an I6 class for each kind, and an I6 object for each of its own objects. We can meddle with its compilation process here using a further refinement of Include. For instance, suppose we want the I6 class definition for things to come out containing a property like this:

> Class K2_thing ...
> with marmalade_jar_size 6,
> ...

How to arrange this? One way is to create an ordinary I7 property, like so:

> A thing has a number called marmalade jar size. The marmalade jar size of a thing is usually 6. The marmalade jar size property translates into I6 as "marmalade_jar_size".

(Without that last sentence, the property won't get any familiar name.) But sometimes we need more, and want to actually write new material to go into the definition. This can be done like so:

> Include (- with before [; Go: return 1; ], -) when defining a vehicle.

This glues in a new property to the class compiled to represent the I7 kind "vehicle". (See the DM4 for why. However, since the entire actions machinery is different in the I7 world, note that "after", "react_before" and "react_after" no longer have any effect, and nor does "before" for rooms.)

And similarly:

> Include (- has my_funny_attribute, -) when defining the hot air balloon.

If we need a particular I7 object or kind to end up with a particular I6 name, we can write:

> The whatsit object translates into I6 as "whatsit".
> The thingummy kind translates into I6 as "thingummy_class".

Previous | Contents | Next