[MLton] bug in MLton and bug in basis
Wesley W. Terpstra
wesley@terpstra.ca
Fri, 19 Aug 2005 11:51:55 +0200
On Aug 19, 2005, at 12:48 AM, Stephen Weeks wrote:
> Better to make deviant behavior explicit than to hide it. So we
> should either change the type of Socket.Ctl.getERROR or we should add
> MLton.Socket.Ctl.getERROR with the correct type. I think the latter
> would be preferable.
> - val getERROR = getSockOptBool (Prim.Ctl.SOCKET, Prim.Ctl.ERROR)
> + fun getERROR s =
> + getSockOptInt (Prim.Ctl.SOCKET, Prim.Ctl.ERROR) s
> + handle Error.SysErr (_, e) =>
> + case e of
> + NONE => raise Fail "Socket.Ctl.getERROR"
> + | SOME s => s
... won't work. SysErr ("Connection Refused", NONE) for example.
You should do like I said earlier: return SysErr option...
fun getERROR s =
case getSockOptInt (Prim.Ctl.SOCKET, Prim.Ctl.ERROR) s of
0 => NONE
| x => SOME (MakeASysErrUsingStrerror x)
handle ex => SOME ex