You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>BuckleScript is an optimizing compiler which compiles <ahref="http://ocaml.org/">OCaml</a>
432
-
into JavaScript module by module without name mangling.</p>
431
+
into JavaScript module by module <em>without name mangling</em>. The generated code is <em>highly readable</em> and <em>super small</em>,
432
+
see <ahref="http://bloomberg.github.io/bucklescript/js-demo/">Hello world</a> example
433
+
and <ahref="http://bloomberg.github.io/bucklescript/js-demo/#Use_JS_standard_Library_WIP">examples of calling JS libraries</a>.
434
+
BuckleScript is strongly inspired by TypeScript and BabelJS, readability and easy integration with existing JS libraries are essential.</p>
433
435
</div>
434
436
<divclass="paragraph">
435
-
<p>The generated code is highly readable and very small, see <ahref="http://bloomberg.github.io/bucklescript/js-demo/">Hello world</a> example
436
-
and <ahref="http://bloomberg.github.io/bucklescript/js-demo/#Use_JS_standard_Library(WIP)">examples of calling JS libraries</a></p>
437
+
<p>However, there are a few things we believe we do it much better:</p>
438
+
</div>
439
+
<divclass="dlist">
440
+
<dl>
441
+
<dtclass="hdlist1">More type safety and more performant code generated</dt>
442
+
<dd>
443
+
<p>BuckleScript does not invent a new language, it is OCaml. OCaml offers an industrial-strength
444
+
state-of-the-art type system and provides very strong type inference (i.e. No
445
+
verbose type annotation required compared with typescript), which proves
446
+
<ahref="http://queue.acm.org/detail.cfm?id=2038036">invaluable</a> in managing large projects.<br>
447
+
OCaml’s type system is not just for tooling, it is a <em>sound</em> type system which means it is guaranteed that there will
448
+
be no runtime type errors after type checking. Based on it, BuckleScript provide many optimizations during offline
449
+
compilation, see a simple benchmark <ahref="https://github.com/bloomberg/bucklescript#bucklescript-ocaml-stdlib">here</a></p>
450
+
</dd>
451
+
<dtclass="hdlist1">All the benefits of OCaml stay and a feature rich FFI</dt>
452
+
<dd>
453
+
<p>You program can be compiled into <em>native code</em>, <em>JS</em> and even <em>unikernel</em>. The BuckleScript compiler will become even faster
454
+
thanks to <ahref="https://blogs.janestreet.com/flambda/">more and more optimizations</a> in the upstream compiler.<br>
455
+
Thanks to OCaml’s native support of Object structural type system, BuckleScript’s FFI can model JS object natively.
456
+
Some powerful type system features like polymorphic variants and GADTs are also invaluable to model existing JS libraries.<br>
457
+
Unlike most language FFI, the design goal of <ahref="http://bloomberg.github.io/bucklescript/Manual.html#_ocaml_calling_js">BuckleScript FFI</a> is to avoid writing any unsafe JS stubs code while remain the
458
+
native efficiency. We try to avoid any allocation for the FFI.</p>
459
+
</dd>
460
+
<dtclass="hdlist1">Compilation speed is the key to developer experience</dt>
461
+
<dd>
462
+
<p>Our internal benchmark shows that BuckleScript is at least 10x faster than TypeScript,
463
+
there is no magic here: the BuckleScript compiler is written in OCaml which is
464
+
compiled to blazing fast native code.<br>
465
+
However, it does not prevent the reach of BuckleScript compiler,
466
+
it is also compiled to a JS file (gzipped: 700KB for pure OCaml + 300KB for support of <ahref="https://github.com/facebook/reason/">Reason</a>).<br>
467
+
<ahref="http://bloomberg.github.io/bucklescript/js-demo/">The whole playground</a> is powered by the compiler compiled into JS, you can see it is still quite fast.</p>
468
+
</dd>
469
+
</dl>
470
+
</div>
471
+
<divclass="paragraph">
472
+
<p>BuckleScript reaches 1.0 now, it covers the whole OCaml language (except some features highly coupled with runtime, like Gc module, etc)
473
+
if you are interested in BuckleScript, please refer to the <ahref="http://bloomberg.github.io/bucklescript/Manual.html">manual</a></p>
Copy file name to clipboardExpand all lines: site/docsource/blog/index.adoc
+38-5Lines changed: 38 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,43 @@ September 1, 2016 by Hongbo Zhang
6
6
:page-layout: article
7
7
8
8
9
-
'''
10
-
11
9
BuckleScript is an optimizing compiler which compiles http://ocaml.org/[OCaml]
12
-
into JavaScript module by module without name mangling.
10
+
into JavaScript module by module _without name mangling_. The generated code is _highly readable_ and _super small_,
11
+
see http://bloomberg.github.io/bucklescript/js-demo/[Hello world] example
12
+
and http://bloomberg.github.io/bucklescript/js-demo/#Use_JS_standard_Library_WIP[examples of calling JS libraries].
13
+
BuckleScript is strongly inspired by TypeScript and BabelJS, readability and easy integration with existing JS libraries are essential.
14
+
15
+
However, there are a few things we believe we do it much better:
16
+
17
+
More type safety and more performant code generated::
18
+
19
+
BuckleScript does not invent a new language, it is OCaml. OCaml offers an industrial-strength
20
+
state-of-the-art type system and provides very strong type inference (i.e. No
21
+
verbose type annotation required compared with typescript), which proves
22
+
http://queue.acm.org/detail.cfm?id=2038036[invaluable] in managing large projects. +
23
+
OCaml's type system is not just for tooling, it is a _sound_ type system which means it is guaranteed that there will
24
+
be no runtime type errors after type checking. Based on it, BuckleScript provide many optimizations during offline
25
+
compilation, see a simple benchmark https://github.com/bloomberg/bucklescript#bucklescript-ocaml-stdlib[here]
26
+
27
+
All the benefits of OCaml stay and a feature rich FFI::
28
+
29
+
You program can be compiled into _native code_, _JS_ and even _unikernel_. The BuckleScript compiler will become even faster
30
+
thanks to https://blogs.janestreet.com/flambda/[more and more optimizations] in the upstream compiler. +
31
+
Thanks to OCaml's native support of Object structural type system, BuckleScript's FFI can model JS object natively.
32
+
Some powerful type system features like polymorphic variants and GADTs are also invaluable to model existing JS libraries. +
33
+
Unlike most language FFI, the design goal of http://bloomberg.github.io/bucklescript/Manual.html#_ocaml_calling_js[BuckleScript FFI] is to avoid writing any unsafe JS stubs code while remain the
34
+
native efficiency. We try to avoid any allocation for the FFI.
35
+
36
+
Compilation speed is the key to developer experience::
37
+
38
+
Our internal benchmark shows that BuckleScript is at least 10x faster than TypeScript,
39
+
there is no magic here: the BuckleScript compiler is written in OCaml which is
40
+
compiled to blazing fast native code. +
41
+
However, it does not prevent the reach of BuckleScript compiler,
42
+
it is also compiled to a JS file (gzipped: 700KB for pure OCaml + 300KB for support of https://github.com/facebook/reason/[Reason]). +
43
+
http://bloomberg.github.io/bucklescript/js-demo/[The whole playground] is powered by the compiler compiled into JS, you can see it is still quite fast.
44
+
45
+
13
46
14
-
The generated code is highly readable and very small, see http://bloomberg.github.io/bucklescript/js-demo/[Hello world] example
15
-
and http://bloomberg.github.io/bucklescript/js-demo/#Use_JS_standard_Library(WIP)[examples of calling JS libraries]
47
+
BuckleScript reaches 1.0 now, it covers the whole OCaml language (except some features highly coupled with runtime, like Gc module, etc)
48
+
if you are interested in BuckleScript, please refer to the http://bloomberg.github.io/bucklescript/Manual.html[manual]
0 commit comments