Those functional language compilers can each compile a functional language to C code. Google's NaCl SDK can compile C. Is it reasonable to create Native Client applications by compiling first with one of those other compilers and running the result through google's Native Client SDK?
Anyone done this or have concrete info about possibilities, pitfalls, limitations?
Thanks much!
I can only answer from a position of some uncertainty about the internals of Google NaCl, but I know a little bit about MLton.
In theory, it should work. In reality, MLton uses memory in very specific ways and expects to have control over the environment. The main pitfall I can see is if NaCl restricts certain kinds of operations that may be performed in order to guarantee the integrity and safety of the execution environment. This link suggests this might not be a problem though.
Also, the C code that MLton generates is really, really wacky. Once again, it depends exactly what NaCl gives up in terms of the full generality of the environment in order to guarantee safety. You will have very little control over the code that MLton outputs, and rewriting the runtime is a massive undertaking should any modification be required. I would see if it works and then start tweaking any parts of the runtime system that cause problems.
As an aside, if you get MLton code running the browser, I'd love to see the results! :D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With