[MLton] bug in Socket structure signture

Henry Cejtin henry.cejtin@sbcglobal.net
Sat, 02 Jul 2005 17:49:31 -0500


It looks to me like the basis library spec for the socket structure is wrong.
Note that Socket.recvVecFrom (and all its friends) claim to return  a  result
which  includes an address which is polymorphic but such things do not exist.
(I am referring to the free type variable 'sock_type.)  All actual  addresses
are of a specific address family.

As  an  example  of the problem, you can now have an AF_INET family (internet
domain) SOCK_DGRAM socket, and then  use  UnixSock.fromAddr  on  the  address
result of recvVecFrom which, of course, gives you garbage.

Although  I  don't  see  any explicit statement to this effect, I don't think
that it is possible to have the address  family  address  in  the  result  be
different  from that of the socket.  If it can be different, then you have to
really go through the C world of looking at the sin_family member and  encode
this in an ML datatype.

Am I missing something?