It takes time to write such a post for a non-native speaker like me, but I appreciate what the OCaml gives me and believe I am doing good for the community, so I decide to write a short history of ReScript and explain the motivations behind this project.
I like OCaml, that’s why I decided to go to PlClub@UPenn for further study after undergraduate (2011). I wrote lots of tutorials around OCaml and used to be one of the maintainers of camlp4, I was even honored to be listed as core maintainers of OCaml once.
However, the reality is brutal that it’s very difficult to find a decent job using OCaml if you are not interested in Finance or get unlucky with a Jane Street interview. Here a decent job, I mean you get paid as good as those Silicon Valley companies while using your favorite programming language.
JSOO started growing mature back in 2013, it is the first compiler which gets bootstrapped in the browser, truly impressive. However, even for OCaml experts like me, it is really hard to get started with JSOO. It is a black box to me that I can not read the generated JS code under the hood. If your code works under the bytecode but stops working in the browser. You have to do a random guess to do the debugging. These are the impressions I have back then.
The project was originally named OCamlScript but it has a name conflict with an existing package so that it is renamed into BuckleScript.
At a similar time, ReasonML syntax was released, it is a JS friendly syntax for people to take advantage of OCaml. The combination of ReasonML and BuckleScript is very natural. To avoid confusion to users, we call it ReasonML or projects under the ReasonML umbrella – but the heavy lifting is mostly done by BuckleScript.
The development of ReasonML syntax has slowed down since 2018. What worries me is that the remaining commits keep adding stuff that we don’t want. To maintain the compatibility with OCaml for each release, the ReasonML syntax keeps a snapshot for all versions of OCaml AST, the code gets bloated quickly that the parser is even larger than the compiler itself – this is hard to believe, it means that all my hard work to squeeze the performance will be wasted in the parser.
I wish the very few resources could be put into bug fixes instead. We communicated and realized that the top priority for ReasonML syntax is the compatibility for OCaml ecosystem while our top priority is providing the best dev experience for JS users.
It is open source projects and people can have different visions so that we decide a peaceful separation.
At a similar time, Iwan – one of the major contributors of ReasonML syntax, shows us a POC of a handwritten parser which supports the whole language. This is something I want but do not have time to do – a hand written parser for the best error message and better dev experience.
The original goal is to have the hand written parser 100% compatible with ReasonML syntax so that we can finish the transition, but it ends up being slightly different.
The current status of ReScript
Despite the changes of the syntax, the core gets improved day by day. It has over 11,000 commits in the last few years.
We are going to make a release of version 9, we believe it is currently the fastest compiler on the JS market which generates the most readable JS code and yields the smallest JS output size.
I do wish it could be a useful language for people who like OCaml but can use it in their daily JS work. It is a fierce competition in such a market. We have to compete with languages of huge successes: TypeScript. That’s why given a small team with very few resources, we are very focused and don’t want to get distracted by anything else.