7 ms·
If the generated JS were easier to read, js_of_ocaml would be very nearly perfect. I think OCaml's surface syntax is a bit ugly, but the semantics are great.
by implicit 12y ago
If the generated JS were easier to read, js_of_ocaml would be very nearly perfect. I think OCaml's surface syntax is a bit ugly, but the semantics are great.
Particularly, I really like their solution to async programming. I'm paraphrasing a bit, but it looks very nearly identical to an ordinary let ... in binding:
lwt result = xhr "http://example.com" in
lwt secondResult = xhr "this url will be fetched after the first one completes"
and thirdResult = xhr "this url will be fetched in parallel with the second"
in (* use result, secondResult, and thirdResult here *)
This desugars into a nested callback structure having the right shape.
- nmjohn 12y agoThe step library [0] does something similar for javascript. Step( function() { getURL1(this.parallel()); getURL2(this.parallel()); getURL3(this.parallel()); }, function(err, res1, res2, res3) { } ); [0] https://github.com/creationix/step https://github.com/creationix/step