Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Gambit-C, Mlton, or Chicken Scheme with Google's Native Client

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!

like image 770
Lucas Membrane Avatar asked Nov 03 '22 22:11

Lucas Membrane


1 Answers

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

like image 130
Gian Avatar answered Nov 13 '22 00:11

Gian