Inform 7 out...BOGGLE

Inform is a programming language for creating interactive fiction (text adventures). It outputs to the old and venerable z machine standard, which dates back all the way to Zork.

The new version has taken a revolutionary step in making what was once a faily normal object oriented language and changing it to a natural language programming environment. Meaning you tell it what to do to in standard English. Here is some real, actual Inform 7 code:


The Trailer is a room. "A full-length mirror is the main amenity in here, and that suits you just fine." The full-length mirror is scenery in the Trailer. Instead of examining the mirror, try taking inventory. 

The player wears a fedora, a jacket, a shirt, some undershorts, an undershirt, some slacks, a pair of socks, and a pair of shoes. 

Underlying relates one thing to various things. The verb to underlie (it underlies, they underlie, it is underlying, it is underlaid) implies the underlying relation. The verb to be under implies the underlying relation. 

The shirt underlies the jacket. The pair of socks underlies the pair of shoes. The undershorts underlie the slacks. The undershirt underlies the shirt. 

Check taking off:
    if the noun underlies something (called the impediment) which is worn by the player, say "[The impediment] is in the way." instead. 

Carry out taking off:
    now the noun is not underlaid by anything. 

After taking off something:
    say "You are now wearing [list of uppermost things worn by the player]." 

Overlying relates one thing to various things. The verb to overlie (it overlies, they overlie, it is overlying) implies the overlying relation. 

The jacket overlies the shirt. The shoes overlie the socks. The slacks overlie the undershorts. The shirt overlies the undershirt. 

Before wearing something when something (called the impediment) which overlies the noun is worn by the player:
    say "(first removing [the impediment])[line break]";
    silently try taking off the impediment;
    if the player is wearing the impediment, stop the action. 

Before taking off something which underlies something (called the impediment) which is worn by the player:
    say "(first removing [the impediment])[line break]";
    silently try taking off the impediment;
    if the noun underlies something which is worn by the player, stop the action. 

Carry out wearing:
    if the noun overlies something (called the hidden item) worn by the player, now the hidden item underlies the noun. 

Instead of looking under something which is worn by the player:
    if something (called the underwear) underlies the noun, say "You peek at [the underwear]. Yup, still there.";
    otherwise say "Just you in there." 

Instead of taking inventory:
    say "You're carrying [list of things carried by the player][if the player wears something]. You are wearing [list of uppermost things worn by the player][end if]." 

Definition: a thing is uppermost if it is not under something. 

That is real honest to god code. A bit clunky, but amazing that it’s that close to English.

Holy coolness, Batman.

Damn. Damn. That is slick as hell. Checking.

I’ve always liked Inform, and that’s just really damned cool.

It’s like what COBOL was supposed to be!

That is really neat. It makes sense; the relative constraints of text games really are a good place for natural language compilers to shine.

In 2025, this will be the type of language that sexbots are programmed in.

Remember the rule: Any suitably advanced technology will be either applied to porn or war.

Holy crap. This is pretty amazing. I might actually write that IF game I’ve always thought about.

Fuck, that’s going to win awards.

Eh, it’s okay. It’s neat that you can read the source and generally understand it, but writing it requires learning the language just like any other programming language. Which kind of defeats the purpose. The product page says something like “Just download the program and type stuff on the left side and hit Go and it will probably work.” I typed two sentences, basic ones at that, and the syntax wouldn’t compile. Creating a “game” with one room, one item, and one defined action basically took reading through half the documentation.

It seems pretty neat at first, but then I got to this line:

The shirt underlies the jacket. The pair of socks underlies the pair of shoes. The undershorts underlie the slacks. The undershirt underlies the shirt.

Those are English sentences, but that’s not something you would ever, ever say or write in English. So it seems like you have to learn the compiler’s syntax after all, and that would probably take less time to write in C than in Inform 7, assuming you knew the syntax for both already.

I dunno, it’s probably pretty nifty for people who’ve never touched a “real” programming language, and have no desire to. Maybe the biggest advantage is that it’s just not as intimidating.

PRO: Obvious. It’s English! Wow.

CON: Does the fact that it’s a readable subset of English just obfuscate the programming language that it really is? I’d be afraid of being driven insane by constantly confusing real English syntax with the programming language’s syntax.

I have not looked at Inform closely, but what Rob said is basically the problem with these types of languages – they are not really understanding English, and if you deviate very far from the small envelope of what they understand, then you will get a parse error and not necessarily understand why.

So it is not like you can just type in what you want, and it does it.

On the other hand, with a lot of elbow grease, maybe you can widen the syntax enough that most of what people try to say will work (once they get used to the language), and make the error messages good enough that people usually understand very quickly what they did wrong. That could be cool – but still not necessarily all that useful as a programming language.

Because at its core, programming is about thinking logically, and dressing those logical thoughts up in a different syntax does not make them different (even if the syntax seems friendly). A real natural-language-based system would be about you not necessarily needing to be so logical and micromanage-y.

Of course you understand that Inform 7 was written with text adventure authors in mind, and the sort of people that would be interested in writing a text adventure are usually writers themselves who may not be familiar with, or friendly towards, any sort of arcane programmer-esque syntax. Of course this language still has very strict rules regarding how to structure definitions of things, but writing it feels like writing English more or less, and that will be attractive to those who are going to literally write things in this language.

True that. This seems like a good fit for describing things, and how they interact. Which is what I would want in a language for creating text adventures. I’d hate to write qsort in it though.

One neat thing about the language is that the entire thing is a preprocssor; it becomes Inform 6 code before being compiled. You can still escape out to the old version if you want.

I also bet it helps if you understand Inform 6. For example, when I come to a sentence starting with the word “before,” I’m pretty certain I know exactly what kind of Inform 6 code that translates to. (Part of a before block, oddly enough.)

My point though is that the hard part about programming is laying out the logic, not presenting it in the syntax. Syntax might be a barrier to very very newbies, but after a short time it’s just not an issue (unless a language’s syntax really sucks.)

So in a sense they are working on the small problem and not on the big problem. But hey, the small problem is easier to solve, and ya gotta start somewhere I guess.

Frankly, the natural language approach of Inform 7 looks as if it requires a lot more work than plain old C-like, object-oriented Inform (or Hugo, which I much prefer). It seems more like something to show your friends to impress them than an actual tool you’d want to use to write i.f.

The natural-language code seems a lot more approachable to me, a non-programmer, and since it’s only being used for a very specific kind of application with some pretty rigidly defined rules, I’m not sure that whatever loss of clarity in the underlying logic is going to make that big a difference.

Nevertheless, the natural language isn’t all that’s cool about this release - it also adds a whole suite of tools to make it very easy for total beginners to not just write, but also test, debug, index, and do a whole bunch of other tasks that are necessary before your code can be released as a decent game, and do it in a way that results in a very polished text adventure. Things like the skein, which if used properly will automatically create a walkthrough for the finished game, or simply the ability to make a small change, instantly recompile and replay to where you were before.

To sum up - I don’t know if Inform 7 is great as a programming language, but as a text adventure/interactive fiction workshop, it’s pretty amazing.

This is an incorrect assessment of Inform 7. It’s much more than syntactic sugar. I7 also helps greatly in “laying out the logic.”

For instance, this bit of code:

The Dungeon Exit is north of the Pit of Despair.

A fat man is here.

The fat man wears fat pants.

It automatically figures out that you are creating a new room instance, and builds the two-way link between the exit and the pit.

The context moves to The Dungeon Exit, so it knows to create “a fat man” in The Dungeon Exit room.

Finally, it recognizes that fat pants are a new object, and it inherits all the methods necessary to be wearable.

Come on, that’s cool and useful stuff in the context of text adventure programming. Waving your hands at that kind of expressive power is like saying Prolog is just fancy syntax for things you could do in assembly. It’s technically true, but not insightful.