Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000349Core InformKinds and type checkingpublic2010-10-23 20:522010-10-28 00:31
Reporterinfryq 
Assigned Tograham 
PrioritynormalSeveritymildReproducibilityalways
StatusclosedResolutionfixed 
Platformx86OSMac OS XOS Version10.6
Product Version 
Target VersionFixed in Version6F95 
Summary0000349: Illusion of multiple inheritance results in halfway-disappearing objects
DescriptionSo it turns out that Inform 7 doesn't support multiple inheritance, which is a bummer. While trying to convince it to let me do so however, I found this weird behavior.

I attempted to add supporter-ness to a custom kind "cooker" by saying "A cooker can be a supporter." I then declared one of my cookers to be a supporter. This compiled, but when I put things on the cooker-supporter during play, the objects disappear from the game halfway (you can't see them or manipulate them, but showme says they're there). Like this:

> put dishtowel on stove
You put the dishtowel on the stove.
> x dishtowel
You can't see any such thing.
> showme dishtowel
dishtowel - thing
location: the stove in the Kitchen
unlit; inedible; portable
printed name: dishtowel
> showme stove
stove - cooker
    dishtowel
location: in the Kitchen
unlit; inedible; portable
printed plural name: cookers
supporter
printed name: stove
description: The stove has nothing on it.

When I explicitly place something on a cooker-supporter in the game source, the compiler balks, which is correct. It is only when I declare a cooker-supporter, and then attempt to put something on it in play, that the effect occurs. What should probably happen is that either the game should not compile, or it should not let the player put something on the not-really-a-supporter.

Or something else is happening and I'm not properly interpreting what the compiler and game are telling me...
Minimal Source Text To Reproduce
A cooker is a kind of thing.  A cooker can be a supporter.

The Kitchen is a room.
 In the kitchen is a cooker called a stove. The stove is a supporter. The description of the stove is 
"The stove has [a list of things on the stove] on it."


There is a dishtowel in the kitchen.  
[Uncomment the following to have the compiler reject the idea of putting things on the stove:]
[The dishtowel is on the stove.]

test me with "x dishtowel / put dishtowel on stove / x dishtowel / showme dishtowel / showme stove"
TagsNo tags attached.
Effect(mild) Compiler accepts invalid code
Attached Files

- Relationships

-  Notes
(0000738)
graham (administrator)
2010-10-24 05:58

The incorrect sentence is "A cooker can be a supporter", which constructs an either/or property called "supporter". There are then two different adjectival meanings for the word, one for this property, one to denote membership of the kind, and the result is rather difficult for newcomers to interpret. I've therefore explicitly prohibited either/or properties from having the names of kinds, and put in a problem message to that effect.

Inform is rules-based, not object-based. Asking whether it supports multiple-inheritance is really the wrong question - that's of great importance for object oriented languages, but not so much here. What you really want is behaviour which applies to objects of several different kinds at once, and that, in fact, is quite easily written - for instance one can define an adjective to cover all of the possibilities, and then write rules for what happens to things qualified by that adjective.

- Issue History
Date Modified Username Field Change
2010-10-23 20:52 infryq New Issue
2010-10-24 05:58 graham Note Added: 0000738
2010-10-24 05:58 graham Status new => resolved
2010-10-24 05:58 graham Resolution open => fixed
2010-10-24 05:58 graham Assigned To => graham
2010-10-25 21:14 jmcgrew Fixed in Version => 6F95
2010-10-28 00:31 jmcgrew Status resolved => closed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker