[MLton-user] The SML basis library socket module

Stephen Weeks sweeks@sweeks.com
Sun, 28 Sep 2003 12:53:38 -0700


>     I would like to develop a network application using SML, however I
> have run into inconsistencies between SML/NJ, MLton and the basis
> library specification reguarding Non-blocking IO.  According to
> http://sml.sourceforge.net/Basis/socket.html it seems as if you use
> seperate functions for (non)blocking operations (connect vs.
> connectNB), while in the MLton and SML/NJ libraries you need to set a
> socket to non-blocking mode with Socket.Ctl.setNBIO and proceed to use 
> the normal connect function. I also notice the google cache of that
> specification (http://tinyurl.com/oxvp) matches the MLton, SML/NJ
> libraries. Was this a recent change to the basis library that the 
> implementations haven't caught up to yet ?

Yes.  The basis library changes are documented at

	http://sml.sourceforge.net/Basis/history.html

The change that you are seeing occurred on September 15, 2003.  We
have already made the update to our internal version of MLton, and it
will go out with our next release, which is a ways off.  If you want
to be bleeding edge, you can build MLton from the CVS, or you can ask
me to put an experimental release at
	
	http://www.mlton.org/experimental/ 

Please specify the platform if you do.

To alleviate the problem of skew between the release and the online
basis spec, it would be nice to include a copy of the basis spec that
corresponds to each release of MLton.  I think this may be allowed
according to the following bit of their copyright notice.

	Permission to distribute the HTML document electronically on
	any medium other than the internet must be requested from the
	copyright holders by contacting the editors.

I will ask John Reppy and see if I can get permission for MLton.

>     On an unrealted note, what is the recomended way to develop
> applications to be compiled in MLton? I was considering making SDL
> bindings for both SML/NJ and MLton and then use SML/NJ during
> development for better type checking and and faster compile times and
> then shipping with a MLton compiled binary, is this common ?

Yes.  That is what I believe most people do.  It is certainly what we
do with MLton.  We also have stubs for making the basis library in the
version of SML/NJ we are using look more like MLton.  See

	http://cvs.mlton.org/viewcvs.py/mlton/mlton/lib/mlton-stubs-in-smlnj/

Unfortunately, these aren't part of our released packages, but you
still may find them useful.

As to SDL bindings, you might want to check with Anoq of the Sun
<anoq@hardcoreprocessing.com>, either directly, or on this list, which
he reads.  I know he's built an SDL interface for MLton and used it to
build software for Linux and Windows.  A google search for SDL and
MLton yields his page from a while back

	http://www.hardcoreprocessing.com/Freeware/SDLML.html

I'd be interested to hear what the current status is.