Hacker News new | ask | show | jobs
by evincarofautumn 3575 days ago
I was wondering about the practical differences between BuckleScript and js_of_ocaml. Found this brief explanation in the docs[0]:

> Js_of_ocaml takes lowlevel bytecode from OCaml compiler, BuckleScript takes the highlevel rawlambda representation from OCaml compiler

I presume that means different (higher-level) optimisations are available in BuckleScript?

> Js_of_ocaml focuses more on existing OCaml eco-system(opam) while BuckleScript’s major goal is to target npm

Now that is a good idea—npm is a fairly large ecosystem that people are already familiar with. If you haven’t already, you might look into using existing TypeScript interface files to get type information for npm libraries.

> Js_of_ocaml and BuckleScript have slightly different runtime encoding in several places, for example, BuckleScript encodes OCaml Array as JS Array while js_of_ocaml requires its index 0 to be of value 0.

Would it ever be feasible to support interop with js_of_ocaml?

[0]: http://bloomberg.github.io/bucklescript/Manual.html#_compari...

1 comments

yes, it is actually easier to optimize since you have more herusitics. both compiled to js, so yes, it can work together : )