<cods>
Hi. I just started to test bucklescript, but when I try to define a type such as "type tree = Leaf | Node(int, tree, tree);" (from the documentation) I get a syntax error (pointing at the left paren). It's the only line in my test file (other statement seem to works fine)
<cods>
am I missing something obvious?
<cods>
ok, sorry, I think I mixed up things. I need the syntax type tree = Leaf | Node of ... The documentation is a bit confusing.
<cods>
ok, got it. BuckleScript can compile both OCaml and Reason (a different langage) to JS.
<reynir>
cods: Reason is OCaml with a different syntax :)
<cods>
I'm playing with it, and it's so nice. I've now to convince my colleagues to look at it :) We spend so much time with Flow, fighting against a language who has no native typing.
<reynir>
^^
<reynir>
cods: are you using the bucklescript backend?
<cods>
I've not yet configured webpack to automatically compile .re files. I'm just exploring the feature, and also how to use JSX and integrate with React, and how to mix JS with it (when a package doesn't have Reason definition).
<cods>
one nice feature is the generated JS which is quite readable
<reynir>
Why is readable generated JS desirable?
<cods>
to me it helps understanding how the compiler achieves the implementation of the various features. For example, seeing how it can optimize out some tag in variant types make realize that it might not be as costly as we might think.
<cods>
it helps understand*
<reynir>
ah
<reynir>
There's another js backend called js_of_ocaml. To me it seems superior in a lot of ways, but bucklescript is also popular for some reason
<reynir>
the output is pretty unreadable, though
<cods>
Interesting. It is superior in which way?
<reynir>
Well, it can eliminate more tail calls, it preserves more OCaml semantics (so more OCaml code work with js_of_ocaml without modification), and it seems to me the DOM bindings have nicer types although I haven't looked into that too much