LexiFi / gen_js_api

Easy OCaml bindings for Javascript libraries
MIT License
177 stars 31 forks source link

Put Ojs_exn inside Ojs module (breaking change !) #126

Closed mlasson closed 3 years ago

mlasson commented 3 years ago

This module does not seem to be used by public libraries on opam. I don't think this will break a lot of foreign code.

alainfrisch commented 3 years ago

We need to be careful, since forcing to link Ojs_exn makes it more difficult use gen_js_api together with js_of_ocaml stdlib or brr. This is discussed in https://github.com/dbuenzli/brr/issues/2.

The best solution would probably be to have js_of_ocaml come with a "core" interop stdlib that registers the exception to the runtime system, and possibly expose primitives of the runtime system, allowing higher level FFI and binding system to live well together.

Short of having something like that, it seems too dangerous to force linking Ojs_exn. One possibility to "fix" #126 could be to have Ojs_exn be its own library, but it's a bit silly. Anyway, I don't think this PR should be merged, so I'm in favor of closing it. @mlasson, do you agree ?

mlasson commented 3 years ago

Yes, I was arriving at the same conclusion.