Closed jchavarri closed 5 years ago
Thanks for tagging me here, I was very interested in what using just jsoo would look like. 😃
I really like that this reduces or eliminates .js
and .c
code, and you only need to reference the lib/React.re
and interface file.
I do agree that this approach could be a barrier for potential contributors. For example the converKeyToJs
is much less idiomatic and doesn't appear very typesafe.
I will have to mull over a bit more on what the best approach might be.
@benschinn Thanks for your feedback! I really appreciate it.
Based on this, I am inclined to explore next how a non-jsoo solution would look like. It seems that a lightweight eslint config (that we can tweak as needed) could take us a long way 🤔
Closing this as eslint has been set up already by @benschinn in #20 :)
As part of the discussion in #14 one idea was to write the bindings using jsoo
Js
module.This PR explores the idea with a few functions. There is though a lot of unsafety and escape hatches, plus it requires knowing and understanding how all these
Js_of_ocaml.Js
functions and types work.A couple of examples:
'a => Js.meth('b)
. 😕Js.Unsafe
to convert from Js values. For example when transforming the arrays returned fromuseState
oruseReducer
to tuples. I don't think there is a safe way to do this conversion, or at least I couldn't find anything.I am not sure this is the right path to follow. It seems to impose a much higher barrier of entry to potential contributors and the theoretical gains in safety are mostly gone due to the unavoidable unsafety in many cases.
@benschinn I wonder what your thoughts are? 🙂