New Issue: I/O module: return value of write and writeln methods

19490, "mppf", "I/O module: return value of write and writeln methods", "2022-03-18T14:53:06Z"

Today we have these:

proc channel.write(const args ...?k) : bool throws
proc channel.writeln() : bool throws
proc channel.writeln(const args ...?k) : bool throws.

Currently, these return ‘bool’ to be symmetric to ‘read’/’readln’. In practice a failure to ‘write’ is probably an erroneous situation; vs with ‘read’ where EOF is a case most patterns need to consider.

Proposal:

  • Just adjust to return ‘void’ and throw if EOF occurs
proc writer.write(const args ...?k) : void throws
proc writer.writeln() : void throws
proc writer.writeln(const args ...?k) : void throws
  • Ditto for other writing functions (e.g. ‘writef’, ‘writebits’, ‘writeBinary’, …)