19487, "mppf", "I/O module: replace ioLiteral and ioNewline", "2022-03-18T14:45:22Z"
Today we have records ‘ioLiteral’ and ‘ioNewline’ to differentiate from regular string reads/writes:
a string write might work with a format or iostyle to include quotes
a string read has to have some way to find end of string (e.g. looking for space, EOF, or end quote)
reading a newline/literal is more of a matching operation
This situation continues with our current Encoder/Decoder plans [18504]
read, readln, write, writeln will work with the channel’s Encoder/Decoder
readbits, writebits, other binary I/O calls will ignore the channel's Encoder/Decoder
However, ‘ioLiteral’ and ‘ioNewline’ as separate types seems unnecessarily confusing
Also interferes with desire to make ‘read’ use ‘out’ intent (discussed later)
Proposal:
Replace ‘ioLiteral’ and ‘ioNewline’ with ‘matchNewline’ ‘matchLiteral’ ‘writeNewline’ ‘writeLiteral’
These four channel methods will ignore the channel’s current Encoder/Decoder
‘matchLiteral’ will accept a string and an optional ignoreWhiteSpace=true argument
Open Q: Should ‘matchNewline’ and ‘matchLiteral’ return ‘bool’ or throw on failure?