19493, "mppf", "I/O module: change writeBytes to writeData", "2022-03-18T15:03:37Z"
Today we have this:
proc channel.writeBytes(x, len: ssize_t) : bool throws
- Docs do not say what types can be passed in & the routine is generic
- It seems weird to use a C interop type for the size here
- Inconsistent camel casing with readbytes
Proposal:
proc writer.writeData(data, numBytes: int): void throws
-
This function will ignore the channel’s Encoder (and always output binary)
-
‘data’ can be any of:
- string, bytes
- 1-D contiguous array of POD elements
- c_ptr, c_void_ptr
-
Q: is the name ‘writeData’ OK? Could use ‘writeBytes’ or ‘writeBuffer’ or ‘writeMemory’