One of the unique advantages of Inform 7 over other programming languages is that you can often read it out loud. It’s nice to have a language with less punctuation, even if it is more verbose sometimes.
Thinking about this made me realize what a problem the IDE’s handling of tabs is - it goes against the read-out-loud-ability of Inform in a very frustrating way. Of course tables are the worst problem, but then they’re a fundamentally not-out-loud-readable sort of thing. But conditional code can be written in English, sometimes in a not-ambiguous way. It would be an interesting challenge, possibly for I7 or possibly for another language, to come up with a syntax for if-then-else (and maybe even looping) that did not require punctuation or whitespace at all (although as a visual aid, automatic indentation would be nice, and possible if there were no ambiguitites).
So Inform has a more English-like “otherwise” rather than “else.” But that’s mostly cosmetic. What we would really need is a way to distinguish:
if A:
if B:
do C:
else:
do D:
from:
if A:
if B:
do C:
else:
do D:
I guess behind the scenes we have “begin” and “end if,” but they seem so un-Inform like that I’ve never wanted to use them. Other languages have “then,” which seems much more English-like than “begin” but I guess it doesn’t work for loops.
Then again, there’s no reason not to have a different word to use with loops than with conditions - in fact that might make the language even more “natural.”
Just brainstorming here…
if the parlor is open:
check if the liquor cabinet is locked:
If so, unlock the liquor cabinet.
If not, get a drink.
otherwise:
open the parlor.
if Superman is flying:
check if Superman carries Lois (this is the Lois-is-flying condition):
if so, check if Lois is frightened:
if so, Lois screams.
if the Lois-is-flying condition is not so:
Superman calls Lois.
A “named condition” could be like an embedded “To decide” phrase, usable in more places… or its result could simply be stored as a named temporary variable as opposed to the anonymous temporary variables referred to by “if so” and “if not”
Another sort of named condition, although more subtly so…
if Superman is flying:
check first if Superman carries Lois:
if the first is so, check second if Lois is frightened:
if the second is so, Lois screams.
if the first is not so:
Superman calls Lois.
Some alternate phrasings for “end if”…
if Superman is flying:
check if Superman carries Lois:
if so, check if Lois is frightened:
if so, Lois screams.
done checking;
if not:
Superman calls Lois.
No more conditions.
“check that” could be used when there will be no “else”:
if Superman is flying:
check if Superman carries Lois:
check that Lois is frightened:
if confirmed, Lois screams.
if not:
Superman calls Lois.
Perhaps confusing when read aloud, but at least not ambiguous. And the auto-indent could sort it out if you can look at it.
Another wording for a “no-else” condition, though this might be confused with an every turn rule:
As long as Lois is frightened:
Lois screams.
Here’s another “end if,” used to demonstrate the termination of multiple statements…
if so, Lois screams.
if not:
Lois sings.
Superman flies higher.
Do no more.
Or statements could always be single by default, with a keyword to indicate continuation…
if so, Lois screams.
if not:
Lois sings.
Also, Superman flies higher.
Never mind that “check” is already a keyword, I’m just brainstorming. Any ideas?
I’m on a roll! Let’s try…
Repeat with the garment running through every wearable thing:
Now the garment is worn.
Increment the warmth of the player.
Do the next garment. [or just "next", a perfectly good word from Perl]