20150, "lydia-duncan", "IO module: Should we keep (and rename) openreader/openwriter?", "2022-07-01T20:51:47Z"
proc openreader(path:string,
param kind=iokind.dynamic, param locking=true,
start:int(64) = 0, end:int(64) = max(int(64)),
hints:iohints = IOHINT_NONE)
: channel(false, kind, locking) throws
proc openwriter(path:string,
param kind=iokind.dynamic, param locking=true,
start:int(64) = 0, end:int(64) = max(int(64)),
hints:iohints = IOHINT_NONE)
: channel(true, kind, locking) throws
These two functions are for creating a file and returning a reading/writing channel on that file (respectively). They are equivalent to calling open
followed by file.reader
or file.writer
as the case may be, and are provided as a convenience.
Should we keep these functions?
If we keep them, we should probably rename them to openReader
and openWriter
.
#20133 talks about replacing their start
and end
arguments with a single region
argument. Their arguments that are based on channel fields should also get updated to match any changes to them.
Should we error if an invalid region was specified? E.g. starting earlier than 0, ending before it starts, etc.
If we keep them, we should also update their documentation to reflect the same errors as open
(see #20139)