Hacker News new | ask | show | jobs
by kandalf 3574 days ago
Very neat. Can BuckleScript compile Core?
3 comments

It would have to be Core_kernel, the subset of Core that doesn't interact with the runtime or OS. I'm very curious about this and would like to know, too.
If you want to use the OCaml ecosystem, use js_of_ocaml. It has much better compatibility and there is no perf difference.

In particular, js_of_ocaml works with both core_kernel and async_kernel.

Indeed, js_of_ocaml is kind of shocking in its fidelity. It can compile even highly complex libraries that do lots of runtime tricks. Async_kernel and Incremental_kernel both compiled and worked without any issues whatsoever.

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.

as long as it is vanilla OCaml (no c stubs), it should be fine
Uh, given that you don't respect ocaml's memory model and force -safe-string, that's just not true. Any Obj.magic that is correct in OCaml is probably not going to be correct in bucklescript.

Did you actually tried to compile core ?

`-safe-string` is the future. Any compiler can not guarantee its correctness if you write crazy code , `Obj.magic` here. I am not interested in core personally, but I don't see any reason why it will not work if it is vanilla OCaml