Okay, this is a bit technical and verbose, so I thought I’d put it in its own topic. Kerkerkruip has some code that allows us to do fun things with kinds. But apparently, something has changed in Inform 6L02 that makes this fail compilation.
I don’t understand this code very well, since it dives into the I6 layer rather deeply. If anyone can help me, that would be much appreciated.
Here is a sample game:
[code]“Species” by Victor Gijsbers
The lab is a room. “Let’s count kinds.” The player is here.
A vegetable is a kind of thing.
A cucumber is a kind of vegetable.
A tomato is a kind of vegetable.
A cabbage is a kind of vegetable.
Include (-
! Find the kind of an object
[ KindOfObj obj;
return KindHierarchy–>( ( obj.KD_Count ) * 2 );
];
! Test if a kind is a subkind of another kind
[ TestSubkind subclass superclass i;
! These classes are outside the kind heirarchy and must be dealt with first
if ( subclass == Class or Object or Routine or String or VPH_Class )
rfalse;
while (1)
{
if ( KindHierarchy-->i == subclass )
return KindHierarchy-->( KindHierarchy-->(i + 1) * 2 ) == superclass;
i = i + 2;
}
];
-).
To decide which K is kind of/-- (kind - name of kind of value of kind K):
(- KindOfObj( {-default-value-for:kind} ) -).
To repeat with (loopvar - nonexisting K variable) running through the/-- kinds of (kind - name of kind of value of kind K) begin – end:
(- objectloop( {loopvar} && metaclass({loopvar}) == Class && TestSubkind({loopvar}, KindOfObj({-default-value-for:kind})) ) -).
When play begins (this is the count kinds of vegetables rule):
let n be 0;
repeat with S running through the kinds of vegetable:
increase n by 1;
say “There are [n in words] kinds of vegetable.”.[/code]
This now fails with:
It did work previously, though. Has something changed that has to do with “default-value-for”?