"if Glulx sound is not supported" doesn't compile

Glulx Entry Points version 10/150620 has some phrases like this:

To decide whether glk/glulx basic/-- sounds/sound are/is supported:
	(- glk_gestalt( gestalt_Sound, 0 ) -).

If I say

if glulx sound is supported

or

unless glulx sound is supported

that compiles. But sometimes, “unless” is confusing, and I want to be able to say

if glulx sound is not supported

instead, but that doesn’t compile.

I guess I could add something like this

To decide if Glulx sound is not supported:
	if Glulx sound is supported:
		decide no;
	decide yes.

but is that safe? Is there a better way? I don’t understand why “is not supported” doesn’t work in the first place.

1 Like

The problem is that “glk/glulx basic/-- sounds/sound are/is supported” is a whole, impenetrable unit as far as Inform is concerned—it doesn’t know what the individual words of the phrase mean, so it doesn’t know where a “not” could be inserted to change the meaning. That’s why it provides “unless”: it’s the most consistent way to negate an “if” in English.

(For example, if you wrote a phrase “to decide whether everyone is happy”, then “if not everyone is happy” and “if everyone is not happy” have very different meanings in English, but Inform doesn’t understand English well enough to recognize that. Safer to stick to “unless everyone is happy”, which is unambiguous. It knows how to negate various built-in conditions, because it’s specifically been taught, but that doesn’t extend to new phrases defined by authors—best to leave that to the humans.)

Your proposed solution is totally safe, and the best way to do it.

3 Likes

Personally, I’d also add an identical definition of To decide if Glulx sound is unsupported.

Actually, if I were writing Glulx Entry Points in the first place, I might have done something like this (syntax might not be quite correct):

Glulx sound is an object.

Definition: Glulx sound is supported (rather than unsupported) if I6 condition "glk_gestalt( gestalt_Sound, 0 )" says so (it is supported by the runtime).

But that’s a whole separate matter.

2 Likes

Thank you!

This will be better in Inform 11 as the feature flags are a kind of value.

Definition: a glk feature is supported rather than unsupported if I6 routine
	"GlkFeatureTest" says so (it is supported by the interpreter).
2 Likes

Separately, I think Inform would benefit from allowing a generic “X can be Y” declaration, where X and Y are word-blobs rather than objects or kinds. It would be nice to say “if the weather is hot…”, “if weather is not hot”, “now the weather is hot” without having to think about an off-stage weather object.

(Or even “It is daytime.”)

Yes, this reads badly if X is the word “everyone”, but if you set that up, it’s your problem. :)

But maybe the right answer is just to make some off-stage objects.

1 Like

You can actually use the original decide phrase in a way Inform will legally understand now. The question is whether you like how it reads or not.

if not glulx sound is supported

You can place ‘not’ in front of the text of any decide phrase to check for its opposite.

-Wade