3 ms·
On the subject of IF, programming language geeks should all check out Inform 7 - Graham Nelson's programming tool for creating text-based games that run on the
by jameshart 12y ago
On the subject of IF, programming language geeks should all check out Inform 7 - Graham Nelson's programming tool for creating text-based games that run on the Infocom Z-machine (and other related formats). There are a large number of truly astonishing things about the language, compiler and development environment. For example:
- the text editor supports elastic tabstops
- its documentation is embedded right into the development environment, beautifully complete and well written, and filled with great little examples
- compilation error messages are delightfuly detailed, specific, and useful. But if the same error is repeated, the compiler usually tells you "again, this doesn't make sense" rather than hitting you with a wall of repetition.
- many of the language's tools are for creating new language syntaxes for you to write your program with, rather than for the player to use in the game. You can create your own nouns, verbs, adjectives and prepositions to use in your descriptions of the world.
- Its relationships system is very powerful, and includes first-class support for performing operations on the graphs defined by relationships. For example, rooms are related by adjacency, and you can enquire what room is 'the next step via the adjacency relation' from one room towards another to have characters navigate towards a goal - but equally you can create our own relationships and perform similar operations on those.
- in spite of the syntactic restrictions of trying to 'read like English', it surfaces surprisingly rich functional and generics syntaxes; there's a real, grown-up programming language in there.
It is definitely worth a weekend play, if you're looking for a completely different kind of language for a change.
- Karunamon 12y agoTo give an example of the language. Let's say you want a room where the player is eaten by a grue if they linger too long: A room has a number called grue counter. The grue counter of a room is usually 0. A room can be grue infested. A room is usually not grue infested. Every turn while the player is in a grue infested room: Increase the grue counter of the location by one. The dungeon is a room. "You stand in a basic medieval dungeon." The dungeon is grue infested. The first time the player enters the dungeon: try looking; say "It is dark. You are likely to be eaten by a grue." Grue lunch is a scene. Grue lunch begins when the grue counter of the dungeon is greater than 10. When grue lunch begins: say "A large, smelly, foul tempered creature resembling a cross between a troll and an orc lumbers out from one of the open passageways. It sniffs the air, catches your scent, and looses a mighty roar! Before you are able to do anything else, it quickly lunges forward, chomping down on your head with a sickening [bold type]*crunch*" ; end the story saying "You have been eaten by a grue." This is the actual syntax, and it is surprisingly readable. Getting used to what the parser wants you to say can be tricky sometimes - just because the language is english like doesn't mean you can write your code in completely free-form english, but it's damn close! Once you've gotten your head around a few of the foibles, it's a lot less like writing a program and a lot more like just writing a book. In any case, agreed heartily with parent, it's a lot of fun to play around with!
- JabavuAdams 12y agoWow! I was trying to create something like this for knowledge representation, last week. Ended up reading some of the CLIPS manual, then deciding to roll my own, as usual. Wow. Programming is so faddish! I know this, but it's still surprising. What other problems that we're struggling with have been basically solved, in some currently unpopular corner?
- pjc50 12y agoProgramming is so faddish! Yes, sadly; and this is because programming languages, like spoken languages, live and die by their community. And it's harder to cross-pollinate programming languages since all changes must be backwards-compatible with existing source text. Language interop is usually terrible. You can't easily bring just a bit of Inform into an application. This is very slowly improving with the popularity of compile-to-llvm, compile-to-CLR, and compile-to-JS as intermediate targets. The other factor in faddishness is ahistoricity; the most energetic and community-orientated people are young, but interested in building their own new wheels while overthrowing the old wheel order.
- JabavuAdams 12y ago> The other factor in faddishness is ahistoricity; the most energetic and community-orientated people are young, but interested in building their own new wheels while overthrowing the old wheel order. It's easier to write code for a small system than to read code for a large system.
- mintplant 12y agoEmily Short's Inform implementation of extensible "computers" makes for a good read. (Note that anything in [square brackets] is a comment and not interpreted, except when between double quotes, where it's like string interpolation.) http://inform7.com/extensions/Emily%20Short/Computers/source.html http://inform7.com/extensions/Emily%20Short/Computers/source... I especially like the section that implements "search engines", building off of the terms defined in the chapters leading up to it. http://inform7.com/extensions/Emily%20Short/Computers/source_7.html http://inform7.com/extensions/Emily%20Short/Computers/source... Michael Callaghan's fixed-point math extension is less prose-like but worth a peek. It shows how some of the more traditional programming language features can be translated to Inform (eg. explicit loops with ranges as repeat with X running from 1 to 7). http://inform7.com/extensions/Michael%20Callaghan/Fixed%20Point%20Maths/source.html http://inform7.com/extensions/Michael%20Callaghan/Fixed%20Po...
- gwern 12y agoThere are a large number of truly astonishing things about the language, compiler and development environment. For example: - the text editor supports elastic tabstops Spoken like a true programmer. :)
- jameshart 12y agoPriorities :)
- dfan 12y agoHadean Lands (the subject of the article) is written in it. It's a really cool language that is likely to change your thinking in a few ways.