[MLton] Serialization?

Wesley W. Terpstra wesley@terpstra.ca
Mon, 4 Jul 2005 19:36:07 +0200

On Mon, Jul 04, 2005 at 08:46:43AM -0700, Daniel C. Wang wrote:
> Last, I checked SML/NJ pickling library is plain SML it handles sharing 
> and is used by CM to dump the compilation environment.

Yeah, I just finished reading the paper, 'Type-Specialized Serialization
with Sharing'. It's not particularily surprising...

I had already considered a solution like this, but I had hoped to have the
serialization code completely automatic (I mean the 'world' functionality of
MLton essentially already does this). For myself, I also don't care about
mutable values at all---so sharing is beside the point. The thing that does
matter a lot more to me is being able to ship functions, and it doesn't.

I took a quick look into the way Java ships code. It appears that it is able
to dynamically locate classes when they are used. Furthermore, you can
provide your own methods of finding classes. That way, if someone ships you
a class, and you find you lack a dependency, you can automatically grab it.


I don't see how that sort of solution can work for SML. Especially not if
there are side effects in the declaration of a function or its dependents.
I've been skimming the thesis, 'Mobile Computation with Functions', but have
not yet found anything that seriously addresses my concerns.

My current plan is to have a SML schema using only type information.
Then I can whip up a quick 'compiler' which outputs glue code for C++
that mirrors the types and packing scheme. I might as well output some
glue SML code for the packing too, in that case.

What to do about functions... I have no ideas. I suppose I could require
them to be stand-alone, but with MLton I don't want it shipping the inlined
basis library over the wire. Erg.

Wesley W. Terpstra