The OCaml language and compiler is about 30 years old at this point, similar syntax to other ML languages, especially SML, but it fleshes out the language to be more useful in all areas. The compiler up to today has been built up to be modularable, to be possible to make new back-ends and add new features via plugins, especially with recent incarnations that added the new -ppx support.
It can inline and removing the cost of currying when possible:
Tail-call optimizations (with closure removal when possible):
It has the full power of the OCaml syntax and ecosystem, including even the powerful First-Class Modules:
Or see how bucklescript optimizes out unused parts as well:
- Fast compilation: Bucklescript is OCaml, compiler and all, meaning it has one of the fastest optimizing compilers of any language anywhere, the bsb -w watch mode makes your turn around time as fast as you can type and save your source.
- OCaml Modules and other features: The OCaml module system is one of the most powerful, if not 'the' most powerful in the types world, able to do the same as HKT's and typeclasses of Haskell-fame (though substantially faster to compile) to being able to safely type yet pass around dynamic content. Other things like Polymorphic Variants, structural typing, and if you need it, the OCaml object class system are all available for use.
- Readable output: The output is amazingly readable, unlike many of the afore-mentioned languages, which when combined with the immutable and type-safe system makes debugging a breeze.
- Merlin: ocamlmerlin is the standard tool for working with OCaml code for intellisense and more, and it works wonderfully and transparently with Bucklescript.
As well as many many more.
Stay tuned for more articles on Bucklescript. You can click the Bucklescript tag below to see them all.