Comparable adjectives on scenes (or other values)

Here’s yet another case where the compiler looks like it’s working but then goes ahead and does something absolutely insane which makes the whole thing break when you actually try to use it.

A scene has a number called priority.
Definition: a scene is questy if its priority is 1 or more.

That compiles without any issue. But what it actually compiles to is completely nonsensical. In fact, with one small exception, it can be seen as syntax sugar for something like the following:

A scene has a number called priority.
Definition: a scene is questy if the priority of it is at least 1.

Questiness relates an object (called a) to an object (called b) if the priority of a is greater than the priority of b.
The verb to be questier than means the questiness relation.

To decide what object is the questiest (D - description of objects):
  ... some code goes here ...

At first glance, that probably looks fine, but it’s completely wrong. A scene is not an object – it’s a kind of value. So the compiler has just defined a relation and a phrase which does not work on the type of value that it was intended to work on. You can easily see that if you actually try to use the questier than relation or the questiest phrase – you’ll get an error that it was looking for an object but you gave it a value.

But manually writing the unsugared code (with object replaced by scene, and the implementation of the phrase filled in) works perfectly, as far as I can tell (note: so far I only tested that it compiles). The only thing you lose is being able to say Some Important Quest is a questy scene – you have to say Some Important Quest is a scene with priority 1. Okay, that’s not so bad, honestly, particularly since you can just define a second adjective to get that behaviour back if you need it (and just never use the broken comparative and superlative forms of the second adjective).

It wouldn’t be terrible if the compiler just rejected that adjective definition – at least then you know it’s not going to work up front (though there’s really no reason why it can’t work). But accepting the code and then doing entirely the wrong thing without any indication is pretty bad.

As an additional note, the index seems to be incorrect on this matter. If you look in the Phrases index, you can see the implicitly-defined questiest phrase, but the implicitly-defined questiness relation is not listed in the Relations index. The verb isn’t listed in Lexicon or the Verbs index either, though I think that’s not unique to this case (a lot of multiword verbs seem to be omitted from the index).

A similar issue has been mentioned before (here), and that poster settled on the same workaround, though in their case it was the property rather than the holder of the property that was a kind of enumerated value.

By the way, here’s my actual implementation of the phrase, in case someone can see a better way to do it:

To decide what scene is the questiest (D - description of scenes):
	let L be the list of D;
	if L is empty:
		decide on Entire Game;
	let best be entry 1 of L;
	remove entry 1 from L;
	while L is not empty:
		if entry 1 of L is questier than best:
			let best be entry 1 of L;
		remove entry 1 from L;
	decide on best.

That if L is empty case could arguably be the reason why it was decided that this shouldn’t work for kinds of value, as there is no obvious “null” value to choose when the list is empty… but choosing the first value isn’t too bad, honestly.

Hang on, I’m not seeing the problem here.

A scene has a number called priority.
Definition: a scene is questy if its priority is 1 or more.

Flopping is a scene.
Bouncing is a scene.
Leaping is a scene.

The priority of flopping is 1.
The priority of leaping is 3.

To scenedump (S - scene):
	say "[S] has priority [priority of S]";
	if S is questy:
		say " (questy)";
	else:
		say " (not questy)";
	say ".";

When play begins:
	scenedump entire game;
	scenedump flopping;
	scenedump bouncing;
	scenedump leaping;

This produces the correct output:

Entire Game has priority 0 (not questy).
Flopping has priority 1 (questy).
Bouncing has priority 0 (not questy).
Leaping has priority 3 (questy).

I believe the issue is with the comparatives and superlatives, not the adjective itself.

1 Like

So trying to test if flopping is questier than leaping? That’s what we’re talking about?

That produces a compiler error:

In the sentence ‘if flopping is questier than leaping’, it looks as if you intend ‘flopping is questier than leaping’ to be a condition, but that would mean applying the questiness relation (between objects) to kinds of value which do not fit - a scene and a scene - so this must be incorrect.

I agree that looks like a bug – the compiler should be able to do that, and the error message implies that it’s thinking about the questiness relation wrong. But that’s very different from accepting the code and then compiling a game with incorrect behavior!

1 Like

It’s compiling an incorrect definition, which you can see in the index. Yes, it won’t compile if you try to use that definition in the intended way. I assume it would however compile if you tried to ask for the questiest door or is the emerald questier than the crowbar, and I have no idea what that would even do.

Well, we don’t have to assume…

[** Programming error: tried to read (something) **]

…which is the I7 runtime error for trying to evaluate x.P_priority on a thing. (No I6 objects provide this property.) (Except the “value property holder” which is the internal mechanism for holding scene properties.)

Good, thank you for nailing that down to bad code behavior.

2 Likes