Compiler ยท Oct 7, 2017

Announcing BuckleScript 1.7.0

Hongbo Zhang
Compiler Team

New Release

We are excited to announce bs-platform@1.7.0, which highlights following new features and changes:

First class uncurried calling convention

As a functional language, the vanilla OCaml only provides curried calling convention, BuckleScript employs fairly advanced optimizations for curried calling convention, however, the most efficient code is efficient code not relying on optimizations.

Since this release, we provide first class uncurried calling convention, all toolchains provided by BuckleScript can understand uncurried calling convention

Curried calling convention

Let's show the feature with an example file called

let f g x = g x [@bs]

or in Reason

let f = (g, x) => g(. x);

f is curried function, g is an uncurried function due to [@bs] annotation. In Reason, the dot in g(. x) is equivalent to [@bs].

When we evaluate the program with the bsc command...

bsc.exe -i # infer the type

...we will get following inferred interface:

val f : ('a -> 'b [@bs]) -> 'a -> 'b // <1>

or in Reason

let f: ((. 'a) => 'b, 'a) => 'b

As you can see in the examples above, g is inferred as an uncurried function ((. 'a) => 'b) while f is still a curried function.

The compiler will also yield following JS output:

function f (g,x){ return g (x) }

Again, the code shows that...

  • f is optimized and flattened

  • g works like uncurried function

API documentation

Now ocamldoc can understand [@bs] natively(instead of printing a desugared output), we provide an API documentation for the library shipped with BuckleScript, we plan to ship the documentation generator in next release.

More Interop including Js.Promise.t

Unicode string and interpolation support

See String interpolation

Catch exceptions raised on JS side

See Catch exception

Mixed data source


ES6 support in Safari

See fix es6 support in browser

bs-dev-dependencies support in the build system

See build schema accept json literal support

This feature is mentioned in the Functions / Fixed Arguments section.

Bug fixes, performance improvement, and stress tests

[#1549](Notable bug fixes, #1539, #1520

This article was originally released on
Want to read more?
Back to Overview