Inform 7 is a language for creating interactive fiction whose syntax approximates natural language. It is so verbose that it will almost never be a good choice for golfing, but its verbosity is its own challenge, and it can still be fun to enter it in some challenges, such as the recent Hello, World! challenge:

X is room.To Q:(-quit;-).After starting the virtual machine:say "Hello, World!";Q

Now Inform 7 will always be handicapped in such challenges, but it has a particular flaw which I want to ask about. Inform 7 uses a large standard library which controls the Main function; answers on this site would need to choose a hook to add their code to. The problem is that by the time your chosen hook has run a large amount of code has already been run, some of which prints some line breaks causing the challenge entries to be invalid. For example, the following code uses the shortest hook name, but by that point the library will have already printed three blank lines:

X is room.To Q:(-quit;-).Startup:say "Hello, World!";Q

The "After starting the virtual machine" hook is run much earlier, but even by the time it has run one line break has been printed. (I haven't been able to discover its cause yet.)

So I would like to ask the community whether they think it would be acceptable to create a golfing library for Inform 7. Previous discussions seem to indicate that libraries are okay if they are written before a challenge is posted, but that if they alias lots of function names then they're not cool. Well the library I have in mind would not alias any of Inform 7's functions, all it would do is create a consistent and reliable hook at a point in time where nothing has yet been output, and then close up shop afterwards. The library's inclusion in entries would of course count for the code length. It would allow the Hello, World! challenge to be shortened to:

Include C by G.Z:say "Hello, World!"

Edit: I have written the extension. It gives you short cuts to getting input, but nothing more.


1 Answer 1


Yes, that's totally fine. I think writing shorthand libraries or even languages has become much more accepted with things like Pyth (started out as shorthand for Python) or golflua.

So you could even create a new language which compiles to Inform 7, in which case you wouldn't even need the include.

Whether this is necessary is a different question. I feel like even a shorthand for Inform 7 would not exactly be competitive compared with Pyth, CJam etc. And golfing the shorthand will probably not be much different from golfing Inform 7 itself, so you could just use Inform 7 as it is and try to be as short as possible within the constraints of the language. For many languages except the shortest of the short, code golf is more a competition within the language (and maybe with languages of similar verbosity) than trying to win the overall challenge.

  • \$\begingroup\$ That one line of Inform 7 already compiles into 55KLOC of Inform 6, I don't think I want to add another layer of abstraction :P But I'll go ahead and make the library I had in mind. If anyone else wants to add shorthand functions to it we can discuss it later. :) \$\endgroup\$ Aug 29, 2015 at 10:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .