[MLton-user] Problem with Socket.ioDesc in version 20030711 (Bug?)
Stephen Weeks
MLton-user@mlton.org
Mon, 14 Jul 2003 13:45:11 -0700
> While developing a server application, I ran into a strange problem
> with the latest (20030711) mlton compiler while compiling the
> following program:
...
> When I try to compile the program using "mlton -output test
> test.sml" the compiler outputs thousands of lines of what seems to
> be the whole program (including basis library) defunctorized and
> complains about "empty tyvars in PolyVal dec". If I remove the line
> with the call to Socket.ioDesc, the program compiles correctly, but
> unfortunately I need to get the iodesc of the socket for
> polling. Would you have any clue about how to solve this?
Thanks for the bug report. This is a compiler bug. Your guess of
what you are seeing is correct. The compiler detected an internal
inconsistency, and so displayed the entire program for debugging
purposes. We have checked in a fix that will go out with the next
release.
In the meantime, maybe you can use Socket.sockDesc combined with
Socket.select? If you need to use OS.IO.poll, you can rely on the
undocumented fact that in MLton, type Socket.sockDesc = OS.IO.iodesc,
which means that you can use Socket.sockDesc combined with OS.IO.poll.
But I would recommend fixing your code to use Socket.ioDesc as soon as
we have a viable release, since someday we will eliminate this type
equality.