
Js_of_ocaml – A compiler of OCaml bytecode to Javascript - davedx
http://ocsigen.org/js_of_ocaml/
======
implicit
If the generated JS were easier to read, js_of_ocaml would be very nearly
perfect. I think OCaml's surface syntax is a bit ugly, but the semantics are
great.

Particularly, I really like their solution to async programming. I'm
paraphrasing a bit, but it looks very nearly identical to an ordinary let ...
in binding:

    
    
        lwt result       = xhr "http://example.com" in
        lwt secondResult = xhr "this url will be fetched after the first one completes"
        and thirdResult  = xhr "this url will be fetched in parallel with the second"
        in (* use result, secondResult, and thirdResult here *)
    

This desugars into a nested callback structure having the right shape.

~~~
nmjohn
The step library [0] does something similar for javascript.

    
    
      Step(
        function() { 
          getURL1(this.parallel());
          getURL2(this.parallel());
          getURL3(this.parallel());
        },
        function(err, res1, res2, res3) {
        
        }
      );
    

[0] [https://github.com/creationix/step](https://github.com/creationix/step)

------
amirmc
Js_of_ocaml is pretty cool and is used by folks at Facebook for Hack and Flow.
For another example of its use see the awesome IOCaml notebooks.

[http://andrewray.github.io/iocamljs/](http://andrewray.github.io/iocamljs/)

------
saosebastiao
js_of_ocaml as well as ocsigen in general always sounds like it could be
amazing but I've never been able to stay on their hideous web page long
enough. The colors and fonts hurt my eyes too much.

~~~
amirmc
Letting the colours and fonts get in the way of something you admit 'could be
amazing' seems a little short-sighted.

~~~
saosebastiao
One time, I almost bought a very cool robotic prototyping platform, but the
documentation was only in German. In retrospect, my hesitance was a little
short sighted as well...I mean, I could have just learned German, right?

Usability matters, even if it is something as simple as font choices and
colors. If you make it hard(er) to use a product, you've created a barrier to
entry.

~~~
amirmc
Are you seriously comparing _docs in a different language_ to a _colour scheme
you dislike_!? That is an utterly _ridiculous_ comparison.

~~~
saosebastiao
And yet the end effect is the same: I dont use the product. When you want
people to learn your new new framework, complete with all the new idioms and
terminology and workflows, the last thing you should burden your users with is
bizarre asthetics. It makes it hard to scan docs, identify features, and focus
their attention where you want it. You could take a barebones default
wordpress blog and write your docs in that and it would be a reduced barrier
to entry.

~~~
jallmann
The only "problem" is the cute color scheme (each Ocsigen projects gets its
own scheme), but so what. Believe me, you don't notice the colors when using
these docs for Real Work. The content here is solid; complaining about
aesthetics from a quick skim is the equivalent of judging a book by its cover.

