The lost output stream of the Z-machine

The Z-machine standard specifies input stream 0 and 1, and output stream 1, 2, 3 and 4. To me, this raises a question: Why is there no output stream 0?

It can’t be because each number can only mean one thing, since input stream 1 has no connection to output stream 1.

Did Infocom plan for, or even implement, an output stream that was only to be used internally at Infocom, e.g. for debug messages or test reports etc?

1 Like

I always assumed it was because you used +N to enable a stream and -N to disable it so zero doesn’t work with that sort of API.

5 Likes

Ah, of course! That explains the lack of stream 0 for output streams.

Wouldn’t it have been better to number input streams starting from 1 as well, even if it’s not necessary for input streams?

Probably, but maybe the same person didn’t design that particular API? Hell, I write software for a living and I’m not 100% consistent. I still have to live with dumb calls I made 20 years ago, so I have to give some grace to somebody who made a bad call 45 years ago :slight_smile:

2 Likes

True that!

I’m actually amazed how good the design of the Z-machine is, even in version 1.

5 Likes

On Unix, standard input is the file descriptor numbered 0 and standard output is file descriptor 1, of course.

However, this might well be a coincidence; I dunno if there was anything similar in the mainframe systems that the Infocom people were culturally used to (DECSYSTEM-20? maybe running TOPS-20?), nor whether the Unix file descriptor concept / numbering has roots in anything further back than Unix itself.

1 Like