Why is it not possible to enter named properties in a table column by default?

I have been looking over the problem presented in Matching text to a variable name, in which the OP wanted to map specific elements of an enumerated kind of value (skill) to various arithmetic value valued properties (ability scores).

I am trying to understand two things:

  1. Why exactly won’t Inform (either 6M62 or 10.1.2) read a named property (i.e. the property ID itself) as a table cell value?

  2. Is it possible to use a Preform inclusion to allow the compiler to read a named property as a table cell value?

I have been inspecting the Preform grammar for reading table cells (as seen in Syntax.preform):

<table-cell> ::=
	    <table-cell-blank> |    
	    <k-kind-articled> |             
	    <s-named-constant> |    
	    <s-global-variable>     |       [issues PM_TablePlayerEntry or C20TableVariableEntry]
	    <table-cell-value> |    
	    <list-of-double-quotes> |
	    ...                                             [issues PM_TableUnknownEntry]

<table-cell-value> ::=
	    the action of <s-constant-action> |
	    <s-constant-action> |                   
	    the action of <s-explicit-action> |[issues PM_NonconstantActionInTable]
	    <s-explicit-action> |                   [issues PM_NonconstantActionInTable]
	    <instance-of-non-object> |              

These 6M62 definitions seem to correlate with the (apparently unchanged) v10 versions seen at Tables section 21.

I think <table-cell-value> is the non-terminal of interest, because it uses <instance-of-non-object> and <s-type-expression> as productions. Both of these are mapped to internal, which means they trigger specific routines within Inform’s compiler, and between the two of them they seem to handle any kind of allowed value except stored action.

After much reading of the online documentation about Preform, it seemed to me that it should be possible to add:

Include (-
language English

<table-cell-value> ::=
	/e/	<s-property-name>

-) in the Preform grammar.

to allow the property value to be read. However, when that inclusion is actually used, the result is that the Inform compiler halts at the ++ 15% (Drawing inferences) stage according to the Results/Progress tab (and issues a segmentation fault according to command line ni output). The same occurs in both 6M62 and 10.1.2.


It turns out that with the right Preform inclusion, 6M62 will be happy to accept such a table:

Working example
"Brawl and Dodge"

Include (-
language English

<table-cell-value> ::=
	    /b/	<s-property-name>

-) in the Preform grammar.

Place is a room.

A person has a number called strength.
A person has a number called agility.

The strength of the player is 5. The agility of the player is 3.

Skill is a kind of value.
[Some skills are defined by the Table of Skill Difficulties.][results in Problem message about Ability property under 6M62]
Some skills are brawl and dodge.

[can refer to e.g. "strength" or "property strength" in table cell]
Table of Skill Difficulties
Skill	Ability (number valued property)	Difficulty
brawl	strength	4
dodge	agility	4

To decide which K is (stat - arithmetic value of kind K valued property) for (P - person): [note "for" not "of"]
	(- (GProperty(OBJECT_TY, {P}, {stat})) -).

To decide whether (P - person) succeeds at (SK - skill):
	choose the row with Skill of SK in the Table of Skill Difficulties;
	if Ability entry for P is at least Difficulty entry, decide yes;
	decide no.

When play begins:
	showme whether or not player succeeds at brawl;
	showme whether or not player succeeds at dodge.

After jumping:
	choose the row with skill of brawl in Table of Skill Difficulties;
	now the difficulty entry is 7;
	say current table row;
	showme whether or not player succeeds at brawl.

test me with "jump".

The question of why that is the correct Preform inclusion is another matter entirely. I’m not sure why /a/ (or /b/) works when /e/ (or /f/) does not.

Given that this can be made to work (even if only under somewhat mysterious circumstances), I think it’s fair to say that the ability to read a property as a table column should be present out-of-the-box.


As a side note, the line commented as causing a Problem message in 6M62 (if used instead of Some skills are brawl and dodge.) produces:

Problem. I am unable to put any value into the property ‘Ability’, because it seems to have a kind of value which has no actual values.
See the manual: 4.8 > 4.8. New value properties

which looks like maybe the compiler is having trouble interpreting the meaning of the column name in that case. (It wants to create a new property of skills called “Ability” because the table is defining skills?)

The same line under 10.1.2 produces a rather more serious internal error:

Problem. An internal error has occurred: unable to represent kind in Inter. The current sentence is ‘The release number is usually 1’; the error was detected at line 173 of “inform7/runtime-module/Chapter 2/Kind Declarations.w”. This should never happen, and I am now halting in abject failure…