It has been a while since we announced the release of BuckleScript 1.0, and the quality of the BuckleScript compiler and its build system have improved significantly since then.
- Microsoft produced TypeScript
- Facebook developed Flow (written in OCaml)
- Google even made several of them: Google Closure compiler, Google Web Toolkit and Dart
Unfortunately, TypeScript is unsound by design; it is trivial to convert code written in a sound language to an unsound language (like what BuckleScript does), but going the other direction is much more difficult. The type unsoundness means ahead-of-time optimizations are quite challenging.
It is reasonable to expect that using a statically typed language, for example, could provide type soundness and increased opportunities for ahead-of-time optimizations.
- Type soundness and type based optimizations
Not just type-based refactoring, but also type soundness and type-based optimizations. In BuckleScript, the inferred types are proved to be correct. Therefore, the compiler can take advantage of this information for more aggressive optimizations; see here and here.
- Additional code generation back-ends, including native platform and WebAssembly, and Unikernel, will be supported in the future.
- Lightning fast builds
Imagine being able to complete clean builds of 60 modules in less than half a second! One BuckleScript user had this to say:
BuckleScript’s compiler is insanely fast, because Bob Zhang (the project lead) has taken to heart the OCaml obsession with performance and routinely tries to optimise away millisecond-level delays. Once you get a taste of that speed (entire project compiled faster than you can blink), you’ll find it difficult to go back to something slower. It’s like getting to use Git after you’ve used Subversion all your life.
- An industry-strength functional language
- At React Conference 2017 earlier this year, Facebook revealed that OCaml generated using Reason and BuckleScript powers 25 percent of messenger.com.
Please do reach out to me on Twitter (@bobzhang1988) and let me know of other noteworthy projects in which you’re using BuckleScript.
Challenges solved in this release!
First class uncurried calling convention
As a functional language, OCaml only provides curried function calls, and BuckleScript employs fairly advanced optimizations for the curried calling convention. However, the most efficient code is code which does not rely on optimizations.
With this release, we provide first class support for the uncurried calling convention, and all toolchains provided by BuckleScript can understand the uncurried calling convention.
An additional benefit to this language extension is that it works when using the native platform back-end as well.
Now that `ocamldoc` can understand `[@bs]` natively (instead of printing desugared output), we provide API documentation for the library shipped with BuckleScript. We plan to ship the documentation generator in the next release.
- More bindings including `Js.Promise.t`
- Unicode string and interpolation support
- Mixed data sources
- ES6 support in Safari
- `bs-dev-dependencies` support in the build system
- `bs.as` accepts JSON literals
- Bug fixes, performance improvements, and stress tests (including single files with more than 50K lines of code)