The Reason Compiler
Thanks to its great interoperability with JS, BuckleScript can be seen as a "gradually" typed language, where you get to incrementally adopt it in your codebase file-by-file, while keeping the full benefits of a 100% sound and reliable type system, plus extra language features.
BuckleScript has built-in support for Reason, a partner project of ours, to provide an even more familiar experience to existing JS developers.
BuckleScript's type system alone offers three major benefits to make your programs more reliable:
Sound type system. "Sound" here means that the types guarantee that they are what they are, not just 90% of the time. Once a BuckleScript project compiles, there are no runtime type errors. *
Strong type inference. Almost the entirety of the language can be inferred. You don't have to tediously write all the types manually. Feel free to still type out some parts for readability!
Expressive type features. With well-thought-out features like variants, modules and even an opt-in object system, the types guide you through your iteration process and don't block you from expressing what you need.
* The exceptions are some deliberate, optional interoperability hooks.
#High Quality Dead Code Elimination
Function and module level code elimination is facilitated by the well-engineered type system and purity analysis.
At the global level, BuckleScript generates code that are naturally friendly to dead code elimination done by bundling tools such as Rollup and Closure Compiler, after its own sophisticated elimination pass.
The same applies for BuckleScript's own tiny runtime (which is written in BuckleScript itself).
#Runs on Native Too!
* In fact, it even runs on microcontrollers with only a few KBs of memory.
#How Is BuckleScript Different?
#Fast Iteration Loop
BuckleScript's build time is one or two orders of magnitude faster than alternatives. In its watcher mode, the build system usually finishes before you switch screen from the editor to the terminal tab (two digits of milliseconds). A fast iteration cycle reduces need of keeping one's mental state around longer; this in turns allows one to stay in the flow longer and more often.
#Readable Output & Great Interop
Hard to debug (cryptic stack trace, mangled variable names)
Hard to learn from (non-straightforward mapping of concepts from one language to another)
Hard to profile for performance (unclear what runtime performance cost there is)
Hard to integrate with existing hand-written JS code
BuckleScript's JS output is very readable. This is especially important while learning, where users might want to understand how the code's compiled, and to audit for bugs.
#Tiny JS Output
Hello world BuckleScript program generates 20 bytes JS code. Additionally, the standard library pieces you require in are only include when needed.
#Preservation of Code Structure