Room versus Region namespace: is it perfectly okay to have crossover?

I like writing this code in the header:

when play begins:
    now left-hand status line is "[location of player] ([map region of location of player])";

Which works okay. It just means I need to name my regions sensibly. But a couple times I brushed up against something that left me curious. A region has a word in common with a room.

Tree Kingdom is a region. Dead Kingdom is a region.

Tree Free Path is a room in Dead Kingdom.

This feels like it should not affect testing commands or any GO TO commands provided by the player. And basic tests don’t seem to show a clash here, and objectively, I should trust the Inform core programmers and years of people hitting the code to say, yes, this is very robust indeed.

Also there is an easy workaround to say TK is a region. printed name of TK is "Tree Kingdom".

But for whatever reason, that “should” isn’t enough for me and I’m worried I’m missing something nebulous. I’ve had namespace clashes with things and rooms before e.g. if a room is named Trees and there are Big Trees and Small Trees scenery in a Forest. (This is bad coding, yes.)

And of course I’ve let namespace clashes with items happen and stay a while e.g. “old giant” and “giant pin” and Inform, since it couldn’t be expected to read my mind, assumed “giant” was the pin, since it was declared first.)

So I’m wondering, despite the easy workarounds,

  1. does Inform have built-in ways to avoid room vs region name clashes?
  2. is there another easily explainiable reason I should totally not worry about this, or is it best I just use a private-name workaround if all this is really bugging me?

This feels like it should not affect testing commands or any GO TO commands provided by the player.

Presumably your GO TO grammar is defined on rooms, not regions. So that isn’t a problem.

Debug commands could run into ambiguity, which the parser will handle in the usual way:

>showme tree

Which do you mean, Tree Kingdom or Tree Free Path?

>showme kingdom

Which do you mean, Tree Kingdom or Dead Kingdom?

(The SHOWME grammar is defined on objects, which includes both rooms and regions.) Not a big deal there.

In general, two Inform entities with a single word in common isn’t a problem as long as you’re careful not to use that single word by itself. This would be potentially confusing:

if the player is in Tree: […]

So, you know, don’t do that. Or go with “Use unabbreviated object names” option if you’re worried about it. Or the TK and printed name solution. There are many approaches here.


Excellent, thanks for all this! It’s good to know some of Inform’s buffers against programming traps, and it’s neat to have several intuitive, sensible workarounds.