[MLton] overflow vs. SysErr on time functions

Jesper Louis Andersen jlouis@mongers.org
Wed, 7 Jul 2004 20:00:26 +0200

Quoting Stephen Weeks (sweeks@sweeks.com):

> As I alluded to on the Basis Library discussion list, I'm planning to
> change the following functions so that they raise SysErr inval, not
> overflow on time values that are too large.
> 	OS.FileSys.setTime
> 	OS.IO.poll
> 	OS.Process.sleep
> 	Posix.FileSys.utime
> 	Posix.Process.{alarm,sleep}
> 	Socket.select
> Any objections/support?

Support. While I do not read the BLDL here is the main reason:

; To me, overflow means that a value of a given type became so large
  it could not be represented by the type.

; SysErr inval on the other hand means that I passed an illegal value
  to a function.

It should be clear they are not linked to each other at all. Simply,
a Posix function could be so, that it does not accept values above
for instance 10^6, while the integer you pass it of course allows
for its size on the architecture you happen to play with. I think
the prime example for this is usleep(3). Here it seems unlogical to
get an overflow exception.

Then why the above functions? Consistency.