mppf1
March 18, 2022, 2:54pm
1
19490, "mppf", "I/O module: return value of write and writeln methods", "2022-03-18T14:53:06Z"
opened 02:53PM - 18 Mar 22 UTC
type: Design
area: Libraries / Modules
type: Chapel 2.0
Today we have these:
``` chapel
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
``` chapel
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’, …)
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’, …)