Comment Re:targeting javascript? (Score 1) 253
I wanted to comment about efficiency of the code compiled to JS. In most cases, an excellent JS-hacker would not have been written a better code by hand. As an example, here's a simple function written in Opa (iterating a function on a list):
iter(f, list) =
match list with
| [] -> void
| [ hd | tl ] ->
do f(hd)
iter(f, tl)
And it gets compiled to this (before renaming and minimization):
function iter(f, list){
var tmp;
while (c = list.tl) {
f(list.hd);
list = tmp;
}
return js_void;
}
If you want to look at your generated code, launch your compiled server with -d --js-renaming no, and look at all.js somewhere in a directory opa-debug.