Tables and Kinds

I think you can do what you want with a little I6:[spoiler][code]Chapter “Object Types” (for Glulx only)
[Glulx only because the code uses @linearsearch and depends on the instruction layout of Prop_* routines.]

Include (-
! This is the hackiest bit.
[ convertPropRoutineToClass routine result;
@linearsearch OC__Cl 4 routine 1 (-1) 0 0 result;
return (result+5)–>0;
];
-) after “Definitions.i6t”.

An object type is a kind of value.
To decide what object type is the (K - a description of a value of kind K) type: (- convertPropRoutineToClass({K}) -).
To decide what object type is the type of (O - an object): (- ({O}.2) -).
To repeat with (I - a nonexisting object type variable) running through object types begin – end: (- for({I}=K0_kind–>6:{I}:{I}={I}–>6) -).
To decide whether (O - an object) is of type (T - an object type): (- ({O} ofclass {T}) -).
To decide whether (O - an object) is of type (K - a description of a value of kind K):
decide on whether or not O is of type the K type.
To say (T - an object type): (- print (I7_Kind_Name){T}; -).

Chapter “Demo”

There is a room.
When play begins:
say “Thing: [the thing type].”;
say “Player: [the type of the player].”;
showme whether or not the player is of type thing;
showme whether or not the player is of type person;
showme whether or not the player is of type device;
repeat with type running through object types:
say “A type: [the type].”
[/code][/spoiler]
Understand, of course, that this is just a hack.

1 Like