RTP "*** Value handling failed: impossible comparison ***" when trying to create list of texts involved in relation

I’m trying to do something with a relation of things to texts, which seems to be OK as a concept according to WWI 13.13 Relations involving values.

Problem code
"Bad List?"

Place is a room.

A thingy is a kind of thing.

Thingy1 is a thingy.

Word linking relates a thingy to various texts. The verb to wordlink means the word linking relation.

Thingy1 wordlinks "good" and "bad".

Requesting words is an action applying to nothing. Understand "words" as requesting words. The requesting words action has a list of texts called words found.

Report requesting words:
    say "STARTING.";
    repeat with P running through thingy:
	    say "POPULATING.";
	    let L be the list of texts to which P relates by the word linking relation; [causes RTP]
	    say "DISPLAYING.";
	    showme the number of entries in L;
	    do nothing.

Test me with "relations / words".

The attempt to create a list of the texts related to a thing causes an RTP, however:

Bad List?
An Interactive Fiction
Release 1 / Serial number 211227 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD


>test me

>[1] relations
word linking:
  Thingy1 >=> bad
  Thingy1 >=> good

>[2] words
*** Value handling failed: impossible comparison ***

*** Run-time problem P49: Memory allocation proved impossible.

[ The game has finished ]

I’ve seen a few posts with “value handling” related error messages, but most are old and none of them seem to mention “impossible comparison”.

Am I misunderstanding the use of the phrase?

1 Like

If you change word linking to be various thingies to various texts, it works. And if you go backwards, it works:

Link wording relates various texts to a thingy. The verb to linkword means the link wording relation.
"good" linkwords thingy1. "bad" linkwords thingy1.

Instead of jumping:
repeat with P running through thingies begin;
    let L be the list of texts that relate to P by the link wording relation;
    say "[P] [L]";
end repeat;

…but I don’t know why your original doesn’t work.

I suspected it may be something to do with the way that texts are considered to be too numerous to iterate through, effectively infinite like numbers, which is why Inform won’t let you say ‘repeat with T running through texts’, but substituting numbers for texts in otistdog’s original example code works fine…

Well, WWI 13.13 says about the phrase in question:

This phrase produces a list of all Y such that the given value V relates to Y by the given relation. Example: suppose partnership relates various texts to various texts.

Regarding the first sentence: My understanding was that the whole point of this phrase (along with its siblings in that section) is for use in cases where there aren’t finite sets of instances of the kind (i.e. arithmetic values and texts). I didn’t think to test against numbers, but thank you for suggesting that, drpeterbatesuk. It doesn’t work for the situation I’m trying to represent, but it does show that, in principle, this should be OK.

Regarding the second sentence: The example uses a various-to-various relation, but the first paragraph of the section says:

We can create relations in groups, one to various relations, various to one relations, one to one relations, and various to various relations for any combination of kinds.

so it doesn’t seem like the phrases should be limited by the type of relation (and the compiler does accept it as written). Still, it doesn’t seem like there is any particular problem using a various-to-various relation for my purposes, so that’s a good workaround. Thank you, Zed.

Looking at the generated I6 code, it seems that maybe something about the setup of the relation is going wrong. Most built-in relations get a line like:

Array Rel_Record_69 -->
    "lock-fitting relation" ...

but the equivalent array for this relation gets only:

Array Rel_Record_71 -->

And, more to the point, there does not appear to be a routine Rel_Handler_71() that seems to be necessary for the relations machinery to decide how to perform the test requested by the phrase.

Am I correct in thinknig that’s an issue at the I7 compiler level? If so, the workaround is the best option for now, so I’ll take Zed’s answer as a solution.

Having banged my head against it some today, I’m feeling ready to generalize that 6M62 doesn’t like one-to-various relations that have texts on either side.

Lab is a room.

xyz relates one text to various numbers.
The verb to abc means the xyz relation.

lt is always {"a","b","c","d","e","f","g","h","i","j","k"}.

when play begins:
repeat with i running through lt begin;
  say "i: [i].";
  now i abcs a random number from 1 to 100;
end repeat;


i: a.
i: b.
i: c.
i: d.
i: e.
i: f.
Glulxe fatal error: Memory access out of range (302E333C)

But it works with one text to one number or various texts to various numbers.

1 Like

Interesting. The output when compiled for Z-machine is slightly different but fails in the same place:

i: a.
i: b.
i: c.
i: d.
i: e.
i: f.
*** Value handling failed: impossible hashing ***

*** Run-time problem P49: Memory allocation proved impossible.

[ The game has finished ]
1 Like