5 ms·
Very neat. Can BuckleScript compile Core?
by kandalf 10y ago
Very neat. Can BuckleScript compile Core?
- DonPellegrino 10y agoIt 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.
- hongbo_zhang 10y agoas long as it is vanilla OCaml (no c stubs), it should be fine
- Drup 10y agoUh, 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 ?
- hongbo_zhang 10y ago`-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
- Drup 10y agoIf 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.
- yminsky 10y agoIndeed, 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 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.