TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Announcing BuckleScript 1.0

323 pointsby e_d_g_a_rover 8 years ago

14 comments

chenglouover 8 years ago
I&#x27;m on the Facebook Reason team, and we&#x27;re using BuckleScript to compile OCaml into the <i>best</i> compiler output I&#x27;ve ever seen. People didn&#x27;t recognize that my React components were generated, not hand-written.<p>BuckleScript&#x27;s author (hongbo_zhang here) has been incredibly responsive and welcoming.<p>We&#x27;ll be publishing the React.js binding on HN in a few days. Stay tuned! We (including Hongbo) are all sitting in irc #reasonml and <a href="https:&#x2F;&#x2F;gitter.im&#x2F;facebook&#x2F;reason" rel="nofollow">https:&#x2F;&#x2F;gitter.im&#x2F;facebook&#x2F;reason</a>
评论 #12401002 未加载
评论 #12400814 未加载
评论 #12402533 未加载
评论 #12419078 未加载
评论 #12400818 未加载
hongbo_zhangover 8 years ago
I am one of the authors of BuckleScript, you can try BuckleScript in the browser: <a href="http:&#x2F;&#x2F;bloomberg.github.io&#x2F;bucklescript&#x2F;js-demo&#x2F;" rel="nofollow">http:&#x2F;&#x2F;bloomberg.github.io&#x2F;bucklescript&#x2F;js-demo&#x2F;</a><p>Click Examples see how the JS code generated, questions are welcome!
评论 #12400695 未加载
评论 #12400800 未加载
评论 #12402563 未加载
评论 #12400624 未加载
评论 #12402183 未加载
评论 #12402858 未加载
评论 #12400635 未加载
评论 #12400956 未加载
kcorbittover 8 years ago
I&#x27;ve been following Bucklescript&#x27;s development from the sidelines for the last couple of months along with Facebook&#x27;s Reason (<a href="https:&#x2F;&#x2F;facebook.github.io&#x2F;reason&#x2F;javaScriptCompared.html" rel="nofollow">https:&#x2F;&#x2F;facebook.github.io&#x2F;reason&#x2F;javaScriptCompared.html</a>).<p>I&#x27;m very optimistic about the future of these two projects. Both are working hard to build a soundly-typed platform on top of the JS ecosystem. While there are tons of existing languages that can be compiled to JS, the most successful ones are those (like Typescript) that embrace the npm ecosystem and the huge community investment it represents.<p>Both Bucklescript and Reason have a huge focus on seamless JS interop and DX, and stand a good chance of bringing soundly-typed functional programming to a much wider audience!
evincarofautumnover 8 years ago
I was wondering about the practical differences between BuckleScript and js_of_ocaml. Found this brief explanation in the docs[0]:<p>&gt; Js_of_ocaml takes lowlevel bytecode from OCaml compiler, BuckleScript takes the highlevel rawlambda representation from OCaml compiler<p>I presume that means different (higher-level) optimisations are available in BuckleScript?<p>&gt; Js_of_ocaml focuses more on existing OCaml eco-system(opam) while BuckleScript’s major goal is to target npm<p>Now <i>that</i> is a good idea—npm is a fairly large ecosystem that people are already familiar with. If you haven’t already, you might look into using existing TypeScript interface files to get type information for npm libraries.<p>&gt; Js_of_ocaml and BuckleScript have slightly different runtime encoding in several places, for example, BuckleScript encodes OCaml Array as JS Array while js_of_ocaml requires its index 0 to be of value 0.<p>Would it ever be feasible to support interop with js_of_ocaml?<p>[0]: <a href="http:&#x2F;&#x2F;bloomberg.github.io&#x2F;bucklescript&#x2F;Manual.html#_comparisons" rel="nofollow">http:&#x2F;&#x2F;bloomberg.github.io&#x2F;bucklescript&#x2F;Manual.html#_compari...</a>
评论 #12402107 未加载
qwertyuiop924over 8 years ago
This is one of the few JS compiled languages that interest me: Some of these languages add a very thin syntactic layer on Javascript and maybe a type system. If I wanted Javascript, I&#x27;d use Javascript, and if I wanted types, I&#x27;d use Flow, not a new programming language that&#x27;s kinda-sorta-not-really JS.<p>That leaves this, Clojurescript, and SPOCK as the only really interesting projects. They all have runtimes that are unpleasantly large (well, Buckle may not), but that&#x27;s the price of a new language.<p>However, Clojurescript leaves a bad taste in my mouth, and SPOCK stresses javascript implementations in interesting ways. I&#x27;m not really a fan of OCaml, but Buckle looks interesting, and more enjoyable&#x2F;practical than the other two.
评论 #12402765 未加载
评论 #12402732 未加载
评论 #12402527 未加载
评论 #12408769 未加载
magnumkarterover 8 years ago
I&#x27;ve just started learning OCaml. Bucklescript as well as F* and Reason are the reasons I chose OCaml over F#<p><a href="https:&#x2F;&#x2F;www.fstar-lang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.fstar-lang.org&#x2F;</a>
评论 #12408817 未加载
mightybyteover 8 years ago
Here&#x27;s a talk the BuckleScript author recently gave on it.<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=LC3KKHYbSQQ" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=LC3KKHYbSQQ</a>
nothrabannosirover 8 years ago
Very cool!<p>I&#x27;m surprised by this one:<p><a href="https:&#x2F;&#x2F;bloomberg.github.io&#x2F;bucklescript&#x2F;js-demo&#x2F;#Curry_Optimization" rel="nofollow">https:&#x2F;&#x2F;bloomberg.github.io&#x2F;bucklescript&#x2F;js-demo&#x2F;#Curry_Opti...</a><p>Why doesn&#x27;t it actually curry? Impressive output, don&#x27;t get me wrong. But given how native and idiomatic currying is in Javascript, and how much trouble I&#x27;d expect this to have taken to implement... is there a specific reason for this? Just curious.<p>Anyway, again: very impressive. Thanks.<p>EDIT clarification: I expected:<p><pre><code> function f(param) { return curry(32, param); } </code></pre> (or is this to highlight the difference between currying and partial function application?)
评论 #12401896 未加载
评论 #12402095 未加载
PhineasRexover 8 years ago
It looks like tail call optimization only works in simple situations.<p><pre><code> let rec foo i = if i &lt; 0 then &quot;foo&quot; else bar (i - 1) and bar i = if i &lt; 0 then &quot;bar&quot; else foo (i - 1) function foo(i) { if (i &lt; 0) { return &quot;foo&quot;; } else { return bar(i - 1 | 0); } } function bar(i) { if (i &lt; 0) { return &quot;bar&quot;; } else { return foo(i - 1 | 0); } } </code></pre> It would be nice to get a warning when tail calls cannot be optimized.
评论 #12402551 未加载
mullsorkover 8 years ago
OCaml seems to be on an upswing in popularity&#x2F;hype recently. As someone who&#x27;s threading the waters in Clojure but not a fan of the JVM developer experience I&#x27;m curious why OCaml is a great choice.<p>I would love to hear some stories from people using it in production. I&#x27;m leaning towards wanting to use a LISP as it&#x27;s just so elegant... but I feel that getting boggled down in &quot;hard core&quot; functional programming is a bit daunting and limiting.
评论 #12420125 未加载
kasajianover 8 years ago
Since it has a significant overlap with Fable (<a href="https:&#x2F;&#x2F;fable-compiler.github.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fable-compiler.github.io&#x2F;</a>), a comparison would be interesting.
mikebelangerover 8 years ago
The website says BuckleScript can also be compiled into a unikernel, which links to MirageOS. I get the sense that integration between MirageOS unikernels and the javascript Bucklscript compiles down to is a likely usage-case scenario?
andrewfongover 8 years ago
Previously called OCamlScript? The GitHub link at <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10860815" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10860815</a> now goes to Buckle.
评论 #12402424 未加载
millstoneover 8 years ago
This looks really cool. How does the integration with external JavaScript libraries work? Could I use this with something like Three.js?
评论 #12402418 未加载