Tester's Delight

Most hilarious use of “not what you think” spoiler-blurring ever!

I’m sure it’s one of those “you have to be there from the inception of the joke” type of comedy situations!

4 Likes

Everybody talks about testing the game parser, but nobody talks about testing the compiler’s parser.

Graham noticed this one just a few days ago. If you compile this Inform 6 function:

[ TestMe
	print "hello";
];

…the function doesn’t print anything. What? Hey, look, some compiler warnings:

line 10: Warning: Local variable “print” declared but not used
line 10: Warning: Local variable “hello” declared but not used

What? What?

Turns out the function has a typo. It should have been

[ TestMe;
	print "hello";
];

Without the semicolon, print and "hello" are understood as local variables. Which would be an error, except (a) I6 lets you define local variables which override statement keywords, and (b) I6 lets you define local variables with quoted strings.

We knew about (a). It’s a pain in the ass, but it’s the way the language is.

(b) was a total surprise. In certain situations, the compiler doesn’t distinguish between quoted and unquoted strings. Local variable declarations are one of those situations. And nobody has noticed this in thirty years! Or at least, nobody did anything about it.

This means you can commit absurdities like this:

[ TestMe
	"x y" "x+1";
];

These are local variables with spaces and plus signs in them. You can’t use them for anything. The statement/expression parser doesn’t let you quote variable names, and it won’t recognize x+1 as a variable even if there is one named that. It’s just a way to confuse yourself and generate “variable not used” warnings.

Upshot: I’m fixing (b), and I’m not touching (a) with a long stick.

8 Likes

My wife gets the shivers from certain words/names too… l don’t know that I have any of those. I guess certain words can sound ugly to me…

2 Likes

I have a tendency not to complain when the error is on my part.

A=10: A=A/10: ? A
prints "10"

That kind of bugs will get reported.