<meta charset="utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small; ">2010/11/11 Gábor Lehel <span dir="ltr">&lt;<a href="mailto:illissius@gmail.com">illissius@gmail.com</a>&gt;</span></span></div>
</span><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Obviously there are questions here with regards to the functions which<br>
the to-be-serialized function makes use of -- should they be<br>
serialized along with it? Required to be present when it is<br>
deserialized? Is it OK for the function to do something different when<br>
it is loaded compared to when it was stored if its environment is<br>
different, or not OK?</blockquote><div><br></div><meta charset="utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div>I would have say Yes, No, No. At the moment, when you serialise data structure A which references data structure B which references data structure C, using Data.Binary for example, the whole lot (A, B, and C) gets serialised, so that the resulting deserialization of A is denotationally equivalent to the original, regardless of the environment. I don&#39;t see why this shouldn&#39;t be the case for functions also. </div>
<div><br></div><div>So a serialized function should include all its direct and indirect callees. This might result in potentially simple functions ending up enormous when serialized, simply because the call graph, including all it&#39;s libraries and their libraries etc, is that size, but such would be pure function serialization.</div>
<div><br></div><div>This raises the question of what is left. The assembled machine code? For the architecture of the serializer or of the deserializer? Or LLVM IR for architecture independence? C--? Core? I don&#39;t know, but it would be awesome for the serialized representation to be both low-level and architecture independent, then having it JIT compiled when it is deserialized. To me, this means a virtual machine, which I guess is what you need when you want fast mobile code, but I&#39;m just musing here as I know little about programming language implementation.<span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small; "> </span></div>
</span></div>