Today's IE7 confusion: Grammar tokens must have the same....

Here’s the source code that tripped me up today.

Room 1 is a room.

Color is a kind of value. The color are red and blue.

A cube is a kind of thing. A cube has a color. The color of a cube is usually red. Understand “” as a cube. Understand “box” as a cube.

This is the report produced by Inform 7 (build 6F95) on its most recent run through:

Problem. You wrote ‘Understand “box” as a cube’ : but grammar tokens must have the same outcome whatever the way they are reached, so writing a line like 'Understand “within” or “next to [something]” as “[my token]” must be wrong: one way it produces a thing, the other way it doesn’t.

See the manual: 16.13 > New tokens

I found this error message pretty confusing and banged my head on the wall for some time. If I took out either Understand statement, it compiled just fine, but it kicked me back out if I had both of them. Eventually, I found my problem:

Understand “” as a cube.

should have been

Understand the color property as describing a cube.

My question is: was the error message appropriate to this circumstance? I’m perfectly happy filing a bug report if this was a bug, but I feel like it might just be my failure to understand the error message, and I wanted to loop through for other people’s thoughts before proceeding.

I would have read that error message –

– as saying that Inform can’t tell, after reading that line, whether ‘[my token]’ is meant to be a token for a thing (the [something] mentioned) or not. (In which case the reference to the manual should possibly be to section 16.14 > Tokens can produce values rather than to 16.13.)

However, Inform shouldn’t have the SAME trouble with your ‘cubes’ that are explicitly asserted to be things, should it?

There seems to be something fishy here, but I’m not sure that it isn’t really my understanding of it that’s muddy.

This looks like a bug. The line

Understand "" as a cube.

…shouldn’t define a grammar token at all. A token-defining line would have a bracketed string on the right, e.g.:

Understand "hue " as "[hue]".

The lines

Understand "box" as a cube. 
Understand the color property as describing a cube.

…are not defining a new grammar token; they’re defining synonyms for a class of object. (That ultimately affects the parsing behavior of the built-in “[something]” token.)

Thank you both. I’ll file a bug report.