Possible Inform bug - properties and global variables with the same name?

I encountered this while working on a bigger project. Here’s some code that triggers it:

"Test" by tech_hutch

World is a room.

The thingy is a number that varies.

People have a number called thingy.

This gives:

Problem. Before reading ‘The thingy is a number that varies’, I already knew that ‘thingy’ is a nothing valued property, and it is too late to change now.

Is this a bug, or did I misunderstand something? I don’t see why I wouldn’t be allowed to have a global variable and a property on a kind of thing have the same name.

In general, in Inform, you can’t have two entities with the same name.

There are some exceptions. (You can define a phrase called “thingy” along with a thing or global variable with the same name.) But don’t expect it as a commonplace.

Hm, okay. It would be nice if it gave an error that described the problem. Thanks for the explanation.

The error is in the right ballpark: you said “thingy” is two different things, which sounds like an attempt to change it in mid-compile.

The error message is bad in two ways, though. It says that “thingy” is a nothing-valued property, but you’re declaring it as a number-valued property. And the “already knew” implies that the property was declared earlier, where in fact it was declared later.

This isn’t exactly wrong – the compiler doesn’t have to read definitions in order – but it would be better to link to the declaration line and say “Thingy is a number-valued property declared here.” In some situations Inform does this, but here the error message is shorter and vaguer. (And, again, wrong about the property type.)

So there’s a bug somewhere here, but it’s about error reporting.