The DM4 p. 61 gives an example:
Object "goose that lays the golden eggs"
class Bird Treasure;
and states: “(It inherits from Object first and then Bird and then Treasure, attribute settings and property values from later-mentioned classes overriding earlier ones, so if these classes should give contradictory instructions then Treasure gets the last word.)”
From the experiments I’ve been doing with Inform 6.31 (10th Feb 2006), this doesn’t seem to actually be the case. Instead, it looks like it’s the earlier-mentioned class (i.e. left-most in a class list) which gets precedence in defining either properties or methods, and the class used to start the object definition counts as the earliest of all. For example:
Class Bird
with wingspan 5,
relevance 1;
Class Treasure
with score_value 10,
relevance 100;
Object "goose that lays the golden eggs"
class Bird Treasure;
[ Main x;
objectloop (x ofclass Object)
{
print "The ", (name) x, " has a relevance of ", x.relevance, ".^";
}
];
produces output (using frotz):
The goose that lays the golden eggs has a relevance of 1.
[Hit any key to exit.]
This shows that the relevance property’s value was inherited from the Bird class, not the Treasure class. Adding:
Bird "ostrich that lays the golden eggs"
class Treasure;
Treasure "canary that lays the golden eggs"
class Bird;
Object "crow that lays the golden eggs"
class Treasure Bird;
changes the output to:
The goose that lays the golden eggs has a relevance of 1.
The ostrich that lays the golden eggs has a relevance of 1.
The canary that lays the golden eggs has a relevance of 100.
The crow that lays the golden eggs has a relevance of 100.
[Hit any key to exit.]
Note how the relevance score of 100 (from the Treasure class) is only applied to those objects where the Treasure class is “mentioned” first, either as the first word of the object definition or the first class of the class property.
Am I misunderstanding how the documentation says this is supposed to work? If not, is this an error in the DM4 or a bug in that version of I6?