Open bobzhang opened 8 years ago
That sounds great! There seems to be area for improvement right now in how CommonML
uses js_of_ocaml
and debugability/sourcemape. If you can create a backend that produces readable/debuggable JS, that's truly awesome and I'd be really excited about it.
There doesn't appear to be any way to file issues on your branch. (I noticed one critical "optimization" is not yet performed that should probably be prioritized). Can you state how you'd like people to file issues?
Can you explain your general approach for generating JS? If someone were to make a new js backend, it would be really great if someone were able to benefit from the new f-lambda
optimizations that are coming. In order for OCaml to be considered a first class player on the web, performance should be a top priority, as well as debugability (I know those can sometimes be at odds with each other but having flags control which side of the spectrum you fall would be ideal). I would guess that it's possible to create JS compilation targets that run much faster than equivalent hand-written JS. There are a couple of issues right now making that more difficult with js_of_ocaml
: The record fields are turned into numeric indices because it uses the ocamlc
output which has erased the label names by that point. In some JS engines this is good for perf and in others it may be bad. Either way, it makes debugging more difficult.
I see a couple of interesting things in your fork:
ocamldebug
's time traveling debugger inside of JS?CommonML
- the JS output could automatically create granular modules that can be shared and you could perhaps only generate the small number of modules that actually changed - instead of having to reanalyze all of the JS every build (which takes time).I'd definitely like to hear more about your general approach and goals.
Hi, this is a nice piece of work. Actually I am doing something that you might find interesting, I am adding a new javascript backend to ocaml https://github.com/bobzhang/ocaml/tree/master Unlike js_of_ocaml, here I aim to produce readable javascript code, the output looks very promising: http://zhanghongbo.me/js-demo It already support most of the language(except missing some primitives, tailcall, currying, none of them is a blocking issue). I think ocaml has a great potential to produce javascript code as good as typescript while having a sane type system.