Glk extension idea: Out-of-band messaging

Have you ever wished you could send logging messages before the Glk window system is initialised? Or that it was easier and more reliable to display error messages in your Glk-using VM?

I’ve had questions like this when working on my Emglken project. Git by default uses printf to display errors, which adds a huge amount of code to the Emscripten compiled Javascript. Glulxe on the other hand creates a new window for error messages, and in the Glk library I’m developing opening new windows is an asynchronous action, meaning almost the entire Glulxe codebase would have severe performance issues.

So I had the idea of defining a few additional functions for sending logging and error messages out-of-band, ie, outside the Glk window system. These functions would be fast and safe to call at all times.

Read the draft specification here.

As it is modelled on GlkOte, there are three severity levels, and I added a function for cancelling warnings because GlkOte does, even though I’m not too sure when that would be useful.

Thoughts and question?

I like the idea! I’m remembering the headache of debugging problems that occurred before the main window opened; functions like this would make it so much easier.

For Inform 7 texts with substitutions, what is the most natural type of Glk API? Should I add buffer (ie, pointer + length) functions for that?

It seems like using the stream should be sufficient for that? Just switch on the message stream and use the usual printing functions.

Maybe. I couldn’t remember if Inform 7 normally buffers it first or not.