Click Examples see how the JS code generated, questions are welcome!
Click Examples see how the JS code generated, questions are welcome!
I think between modular implicits[0], multicore support (both coming soon), along with BuckleScript and js_of_ocaml, Ocaml will be the functional language to beat in the coming years.
0. For those unfamiliar with modular implicits (Scala has them), they are kind of like type classes, so we won't have to write things like "print_string" or "print_int" anymore; we can just write "print".
Edit: NEvermind, I see you're compiling the lambda IR. So hopefully support for modular implicits will be automatic!
Since you mentioned Scala ... you realize Scala has had those properties for years, don't you?
Also, performance-wise, with multicore and the new optimizations with flambda, Ocaml will be particularly interesting.
One question here: how tight the compiler is binded to OCaml semantics? Besides Reason, do you think it's possible to build a frontend for other languages and integrate the backend of BuckleScript to generate beautiful JS as well? Or in other words, what property do you think a language should have so we can generate this level of beautiful JS outputs?
BTW: Please understand I'm not objecting OCaml, I do believe OCaml is an awesome language, but my point is: if possible, we should make this beautiful backend for generating human-readable JS more accessible than restricting it to OCaml only, shouldn't we :)
How did you become so proficient with the OCaml compiler internals? When you started the project did you already know that you can compile to idiomatic js or was that discovered through experimentation?
Did you actually tried to compile core ?
In particular, js_of_ocaml works with both core_kernel and async_kernel.
We've even built some support for making incrementally rendered web-apps in OCaml, using Async and Incremental. Here's a link:
https://github.com/janestreet/incr_dom
It sounds like Bucklescript is doing something quite different, which is to aim for pretty JavaScript output, while compromising and maintaining semantic consistency with OCaml. I don't fully understand the use-case, but for us, js-of-ocaml is clearly the thing we want.
bucklescript doesn't respect the OCaml memory model and runtime semantics, which makes it incompatible with some part of the ecosystem.
Js_of_ocaml already has various features that bucklescript doesn't have: dynlink, support for concurrency libraries such as lwt and async, etc. It's also much more stable and battle-tested.