[MLton] FFI types

Stephen Weeks MLton@mlton.org
Thu, 12 May 2005 15:01:17 -0700


> I was surprised that MLton didn't produce any error message when I
> did an _import claiming that a function returned an array.

I don't see why you were surprised.  C functions can return SML
arrays, either by returning one they were passed or by calling back to
SML to allocate one.

> Concerning Tom7's mail, is there any reason why the FFI couldn't be
> tweaked so that xxx option's could be passed and returned if the xxx
> type was a string or ref or array or vector, converting between ML
> NONE and C NULL while adding SOME in the other cases?

It could be done but it would be a lot of work.  The compiler
internals don't even know about the option type, which is declared by
ordinary SML code in the basis library.  It might be easier to have a
stub generator generate the wrappers rather than hacking it into the
compiler.

> Completely unrelated to the above, my friend Igor noticed that MLton
> is no longer mentioned on the Programming Language Shootout page
> (http://shootout.alioth.debian.org).  (You can still see MLton stuff
> if you click on the link `The Great'.)  Does any one know why?

They did that a while ago, the idea being to choose only one
representative of a language for the "ordinary" shootout so as not to
overwhelm readers.  Why they chose SML/NJ instead of MLton I have no
idea.  There have been a couple of requests to use MLton, including
one I recently sent to Brent.  It certainly makes sense to me to use
MLton, since it is a performance comparison page and using SML/NJ
makes SML look pretty bad.