Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Many people, including me, were pretty bummed out by that whole process. There was a definite dip in activity for a while. I also stayed away, because for me, it was basically more churn at a time when I was already feeling burned out.

I learned from all this, that at least for the near term, OCaml is by far the most stable part of the... OCaml ecosystem :) I'm fine with that, since I started out with OCaml and like it, but I do worry for everyone that prefers JS-like syntax and wants to do a lot of client-side programming.



I'm still confused - is there a set of syntax/language/compilers that will allow me to have one codebase, one syntax, and run the server as native code (possibly with nodejs as an option) - and use same language for the front-end?

As far as I understand it - with ReScript, deploying via ocaml compile to native is not supported - you get nodejs as the server?


Yes. OCaml + all of the 3 OCaml-to-JS compilers support OCaml syntax.

Dream itself demonstrates:

- Server and client both written in Reason, using ocamlc+Melange https://github.com/aantron/dream/tree/master/example/r-fulls...

That example could also have been written in OCaml syntax, because ocamlc (native) and Melange (JS) both support OCaml. However, Reason is nicer if you want to use React with JSX on the client.

- Server and client both written in OCaml, using ocamlc+Js_of_ocaml https://github.com/aantron/dream/tree/master/example/w-fulls...

- The remaining example uses Ocaml on the server and ReScript on the client, using the ReScript compiler. However, you could use OCaml on the client with the ReScript compiler. Just as with Melange, you would lose access to nice JSX syntax https://github.com/aantron/dream/tree/master/example/w-fulls...

It's definitely a lot and not user-friendly to have to decide between all these options, but the community is experimenting greatly right now... so it's good and bad, and that's how it is :/

As for Node.js, using ReScript syntax requires you to use Node.js on the server side, but that is the only coupling. If you write your server side in OCaml or Reason, you can compile it to native code with ocamlc (technically, ocamlopt is the internal command; nobody uses either one directly, but the build system calls them).

EDIT to clarify the last paragraph: the only coupling is that ReScript compiles only to JS. Everything else compiles to both JS and native and by multiple compilers...


> is there a set of syntax/language/compilers that will allow me to have one codebase, one syntax, and run the server as native code (possibly with nodejs as an option) - and use same language for the front-end?

You can use the normal OCaml syntax with the main OCaml compiler and the js_of_ocaml compiler. If you just want something in the ecosystem that's boring and reliable these are almost certainly the way to go.


Agreed on Js_of_ocaml as a stable choice.

However, even Js_of_ocaml is suffering a slight complication :P There is the recent release of Brr https://erratique.ch/software/brr/doc/, a Js_of_ocaml library replacement (i.e. you keep the compiler but use this instead of the library that comes with Js_of_ocaml).

I heard good reviews of Brr, but haven't tried it myself yet. We will probably have a Brr full-stack example in Dream, eventually.

Personally, I currently use

- Dream on the server (an ancient version, didn't have time to keep up with Dream development in my own app!).

- Just plain JS and the JS ecosystem on the client.

- ReScript/Melange for compiling a couple files to JS from OCaml so that they can trivially interop with my mostly-JS client.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: