Currently, the Inform 6 compiler perfectly handles Z-machine dictionary sizes autonomously behind the scenes. However, if a user attempts to explicitly configure $DICT_WORD_SIZE to a mathematically valid value for a v3 game, the compiler throws a fatal error due to a flawed guardrail and a mix-up between bytes and Z-characters.
The compiler's internal pipeline already handles Z-code dictionary construction flawlessly without needing the $DICT_WORD_SIZE memory setting:
-
In text.c: In dictionary_prepare_z(), the compiler completely ignores the $DICT_WORD_SIZE setting and correctly hardcodes the dictionary text size based on the target version using int dictsize = (version_number==3) ? 6 : 9;. Note that this correctly limits the size to 6 Z-characters for v3 (which packs into 4 bytes).
-
In symbols.c: The compiler safely exposes the correct byte size to the game code by dynamically creating the constant: create_symbol("DICT_WORD_SIZE", ((version_number==3)?4:6), CONSTANT_T);.
Because a v3 dictionary word uses 4 bytes, a user might explicitly pass $DICT_WORD_SIZE=4 on the command line when compiling a v3 game. This is technically accurate.
However, doing so triggers a fatal error: You cannot change DICT_WORD_SIZE in Z-code.
This is triggered by a hardcoded check in inform.c that enforces DICT_WORD_SIZE == 6. The root of this check appears to be a historical unit confusion between bytes and characters. We can see this confusion in the option description inside options.c:
"DICT_WORD_SIZE is the number of characters in a dictionary word. In Z-code this is always 6 (only 4 are used in v3 games)."
This comment conflates Z-characters (6 are used in v3) with bytes (4 are used in v3). Because the developer was thinking "always 6," they locked the memory setting to 6 in inform.c.
Consequently, the compiler throws a fatal error on mathematically valid configurations before it even reaches the dictionary construction logic.
Because the entire Z-code pipeline completely bypasses the command-line $DICT_WORD_SIZE setting to correctly construct the dictionary anyway, throwing a fatal error here is unnecessary. It would be much more user-friendly to downgrade this check to a simple warning (e.g., "Warning: The $DICT_WORD_SIZE setting is ignored in Z-code; dictionary sizes are set automatically"), allowing compilation to proceed normally.
Currently, the Inform 6 compiler perfectly handles Z-machine dictionary sizes autonomously behind the scenes. However, if a user attempts to explicitly configure $DICT_WORD_SIZE to a mathematically valid value for a v3 game, the compiler throws a fatal error due to a flawed guardrail and a mix-up between bytes and Z-characters.
The compiler's internal pipeline already handles Z-code dictionary construction flawlessly without needing the $DICT_WORD_SIZE memory setting:
In text.c: In dictionary_prepare_z(), the compiler completely ignores the $DICT_WORD_SIZE setting and correctly hardcodes the dictionary text size based on the target version using int dictsize = (version_number==3) ? 6 : 9;. Note that this correctly limits the size to 6 Z-characters for v3 (which packs into 4 bytes).
In symbols.c: The compiler safely exposes the correct byte size to the game code by dynamically creating the constant: create_symbol("DICT_WORD_SIZE", ((version_number==3)?4:6), CONSTANT_T);.
Because a v3 dictionary word uses 4 bytes, a user might explicitly pass $DICT_WORD_SIZE=4 on the command line when compiling a v3 game. This is technically accurate.
However, doing so triggers a fatal error: You cannot change DICT_WORD_SIZE in Z-code.
This is triggered by a hardcoded check in inform.c that enforces DICT_WORD_SIZE == 6. The root of this check appears to be a historical unit confusion between bytes and characters. We can see this confusion in the option description inside options.c:
"DICT_WORD_SIZE is the number of characters in a dictionary word. In Z-code this is always 6 (only 4 are used in v3 games)."
This comment conflates Z-characters (6 are used in v3) with bytes (4 are used in v3). Because the developer was thinking "always 6," they locked the memory setting to 6 in inform.c.
Consequently, the compiler throws a fatal error on mathematically valid configurations before it even reaches the dictionary construction logic.
Because the entire Z-code pipeline completely bypasses the command-line $DICT_WORD_SIZE setting to correctly construct the dictionary anyway, throwing a fatal error here is unnecessary. It would be much more user-friendly to downgrade this check to a simple warning (e.g., "Warning: The $DICT_WORD_SIZE setting is ignored in Z-code; dictionary sizes are set automatically"), allowing compilation to proceed normally.