[MLton] Serialization?
Wesley W. Terpstra
wesley@terpstra.ca
Mon, 4 Jul 2005 12:28:27 +0200
I was wondering if anyone has a good idea how to implement a generic
serialization library _without_ language support?
I mean something like: val serialize: 'a -> string
and val deserialize: string -> 'a
Assuming Matthew ever makes the bytecode portable ;), then everything in SML
should be pretty easy to serialize/deserialize, but how to do it well? I ask
because the current project I am working on needs to send events across the
wire that correspond to a user-defined type. I could require the user to
specify how to serialize their type, but it seems to me that MLton already
has all the information required.
Even if the user is required to serialize things by hand, he would still
need to be able to ship functions across. Matthew's bytecode seems the best
way to acheive this, but I don't know how feasible it is to run bytecode
within an existing MLton application.
That said, how can I help make the bytecode portable?
Also, what level of interaction is inteded between a MLton-built application
and bytecode that is run inside it?
... for me, I just need to be able to call the 'main' function of the
bytecode with a parameter and recover the result. The bytecode need not
read any variables from the host, but I imagine some people might want that.
I also don't really want the bytecode to make C-calls of the 'rmdir' sort.
--
Wesley W. Terpstra