Variable, property, or phrase names with the first several characters in common

Is there any reason to be concerned that Inform might get confused by names of variables, properties, phrases, etc. that have the first several characters in common?

(I am not actually trying to use the code below in a project. These are just made-up examples of similar names.)

Example 1:

A crossword puzzle has some text called crossword-clues-across.
A crossword puzzle has some text called crossword-clues-down.
A crossword puzzle has some text called crossword-solution.

Crossword-status is a kind of value.
A crossword puzzle has a crossword-status.
The crossword-statuses are solved and unsolved.

To say crossword-clues:
	say "asdf".

What if, instead of hyphenated names, you were to use unhyphenated names with the first word or two in common? Is there any reason to think that might confuse Inform?

Example 2:

A crossword puzzle has some text called crossword clues across.
A crossword puzzle has some text called crossword clues down.
A crossword puzzle has some text called crossword solution.

Crossword status is a kind of value.
A crossword puzzle has a crossword status.
The crossword statuses are solved and unsolved.

To say crossword clues:
	say "asdf".

Personally, for any variable that isn’t shown in the text I would make 8 characters or less just to save typing.

xwacross
xwdown
xwsolutn
xwstatus

1 Like

If you use the full name consistently, Inform usually won’t get confused.

If it does get confused, I find it’s because of verbs or prepositions: names with “is” or “of” in them. Phrases like “the length of the mask of the king” might be misinterpreted if one of those "of"s is part of a name.

A crossword puzzle has some text called crossword clues across.
A crossword puzzle has some text called crossword clues down.
A crossword puzzle has some text called crossword solution.

If you define all those objects and then refer to “the crossword”, the compiler might pick a “crossword” object in a surprising way. You can avoid this by always using the full name, but it’s easy to slip up.

The hyphenated version avoids this risk. So does the “unabbreviated object names” options mentioned in chapter 3.2.

I should also point out that the I7 compiler always recognizes terms word by word, using complete whitespace-delimited words. It will never confuse two words just because they begin with the same N characters.

(In a few cases it recognizes modified forms of words. E.g. once the “dropping” action is defined, it will also recognize “we have dropped”. But there isn’t much of this.)

1 Like

Thank you!