[net.lang] IO in programming languages

dmr@research.UUCP (09/01/83)

I am not sure what the original question was, but here is a reason
C and stdio are as they are: to separate the language definition
and compiler from the IO system.  Both are hard things to design
and I did not want to tackle them together.  All in all I think this
was a wise choice.  There have been at least three complete rewrites
of the IO system for Unix (fin/fout; Lesk's portlib; and stdio)
that differ greatly in detail but are similar in spirit and most
common usage.  It was good not to have to worry about changing
the compiler because of changes in IO.

A related reason was economy of means: to the extent that IO can be handled
by existing mechanisms (subroutine call) it is bad to add to the syntax.

I am well aware of the costs.  There is much value in having a single
document that describes all possible programs in the language,
including those that do IO, instead of leaving it up to the good will
(or good business sense) of the implementors.  For C, in practice,
the portability issue has turned out pretty well.  It may be hard
to implement stdio for CP/M, but it would not be any easier to
implement the same model if it were built into the language spec.
(Though probably there would be more pressure to do it.)

A more serious cost is that the subroutine model doesn't (in C, or in fact
most languages) quite handle IO.  For example, I would be happy
to check the number and type of actual versus formal arguments,
if it were not for printf and scanf.

		Dennis Ritchie