19500, "mppf", "I/O module: deprecate readwrite methods", "2022-03-18T15:29:40Z"
Today we have these:
proc channel.readwrite(const x) : void throws where this.writing
proc channel.readwrite(ref x) : void throws where !this.writing
proc channel.readWriteLiteral(lit:string, ignoreWhiteSpace=true) : void throws
proc channel.readWriteNewline() : void throws
- Single method for both reading and writing was based on an idea in Boost
- with the Boost serialization library, one can write one routine for both reading and writing
- Has not stood the test of time in Chapel in part due to compiler-generated readThis/writeThis
- Simple types just use the compiler-generated readThis/writeThis and then there is no problem
- Complex types (e.g. a list) need special logic for reading, e.g.
if writing { for e in elts { writeElt(e); } } else { while true { if atEnd() then break; addElt(readElt()); } }
Proposal:
- Deprecate readwrite() readWriteLiteral() and readWriteNewline()
- Call methods specific to reading or writing instead