-
Notifications
You must be signed in to change notification settings - Fork 4
2019 001 Correction to PRIM_IO
Author: John Reppy
Last revised: June 4, 2019
Status: proposed
Discussion: issue #26
The PRIM_IO
signature, which is the result signature of the
optional PrimIO
functor, has the wrong type specified for
theavail
field of the reader
datatype.
The current Basis Library specification gives the type as
avail : unit -> int option
For readers that represent input files, the OS.FileSys.fileSize
function
provides the natural implementation of avail
, but it returns the file
size as a Position.int
value. Since int
and Position.int
may be
different types, the correct type for avail
should be
avail : unit -> Position.int option
Some code may break, but the most common use of this API is likely to be in
the Basis Library code provided by SML implementations. In those cases
where Position.int
and int
are the same type, there should be no problem.
This proposal fixes a clear mistake in the original Basis Library specification.
Without this change, it is not possible to support the expected semantics of
avail
(i.e., it returns the file size minus the current position) for large
files when the default int
type is 32-bits or smaller.
- [2019-06-04] Proposed