[I7] "There is an X" vs "X is a thing"

Still trying to figure out how these adjectives really work. I came across this:

[code]A thing can be ephemeral.

Every thing has a number called worth. The worth of a thing is usually 10.
definition: a thing is trivial if its worth is 5 or less.

the garden is a room.

The mist is a thing in the garden. it is trivial.
There is an apple in the garden. It is edible.
There is a banana in the garden. It is trivial.[/code]

One of the three last lines fail. Can you tell which one?

The banana fails. I’m not sure why, but by trial-and-error it seems that if you create something using the “There is an X” syntax rather than “X is a thing” syntax, you cannot use adjectives on that thing (so “it is edible” works because it’s a property, not an adjective). Probably there is some logical reason for this, but I don’t see it. “There is a banana in the garden” appears to create a thing, just like “The mist is a thing in the garden”.

This looks like a bug, actually. You should not be able to define the mist or the banana as “trivial”.

Section 6.6 of the documentation suggests you should be able to:

That suggests that you should be able to define the mist as trivial, and it will come out with worth 5.

matt w beat me to it. Here is my guess for the cause of this problem though. The syntax “There is a banana” doesn’t allow the banana to qualify as a thing for this feature, because its kind isn’t definitely determined until the source text is complete. You could at any future time write “The banana is a fruit” or “The banana is a mathematical statement”, so Inform can’t decide on “thing” until it’s read everything there is to read. Therefore, when you then claim “The banana is trivial”, Inform can’t really figure out what you mean, because “trivial” might mean something entirely different applied to objects of whatever kind the banana turns out to be (“A fruit is trivial if its length is 3 or less.” or “A mathematical statement is trivial rather than nontrivial if someone has proven it.” Note that this math-trivialness isn’t a comparative, so you can’t use it in declarations.), and you just haven’t yet told it that the banana is a mathematical statement and should use math-trivialness rather than the more generic variety. The mist is specifically declared as a “thing”, so Inform knows that you won’t then go back on your word and declare it as some other kind.

matt w is correct about the definition; I had forgotten that part of the docs.

zahariel’s explanation is partially right, it looks like. It’s not the order of declarations that matters. You get the right behavior even if you write “The banana is a thing” later in the code. I7 looks through the entire source code to infer types, before starting to process what adjectives mean.

If you never declare the type of the banana, I7 presumes it’s a thing. But this seems to be happening at the wrong time – that’s the bug, it looks like.

This is a complicated situation. Note that “A thing can be edible or inedible”, but I7 is okay with presuming that the apple is edible; the default-thing presumption is good enough for that.

Thanks for clarifying how things work. I’m not sure this is serious enough to be called a bug.

Here’s another gotcha with not defining kinds:

A thing can be red or blue. 
The street is a room.
There is a red car in the Street.

What color is the car?

It’s blue. Since I don’t tell Inform that a car is a kind of thing, it creates a thing (and not a car) which is called “red car”, but it does not apply the red as a red/blue property, so it defaults to blue. Admittedly, a red thing called a red car would seem like a better guess than a blue thing called a red car (I did say that things can be red or blue), but It just doesn’t work that way.

Thanks for clarifying how things work.

Here’s another gotcha with not defining kinds:

A thing can be red or blue. 
The street is a room.
There is a red car in the street.

Is there a red car in the street?

No. It’s blue, and it’s not a car. Since I never told Inform that a car is a kind of thing, it creates a thing (and not a car) which is called “red car”, but it does not apply the red as a red/blue property, so it defaults to blue. Tricky.

In this case, the principle is simply that “there is a …” defines the name of the object, not any properties about it. Even if car were a kind of thing, “There is a red car” would not define a car.

To be maximally specific:

A car is a kind of thing.
A thing can be red or blue. 
There is a red car called the red car in the street.

Here the first “red car” is determining kind and property, and the second determines the name; they’re independent domains.