Hacker News new | past | comments | ask | show | jobs | submit login

Ok, it might be the end of the day for me and I'm denser than usual, but I can't understand what is this? Ocaml to JS transpiler?

Checked this out, but the reason still eludes me: https://ocaml.io/w/Blog:News/A_new_Reason_for_OCaml (pun intended)




Think of Reason like "CoffeeScript for OCaml"—a nicer surface syntax for the same underlying language. With CoffeeScript, it's a nicer JS. With Reason, it's a nicer OCaml.

OCaml can also be compiled to JavaScript, like pretty much every language can these days.


I feel like FB needed it and also released it to the public, but outside of FB, there's little Reason to use it.


it's a really well-thought-out set of improvements to the ocaml syntax, done by people who actually seem to appreciate MLish syntax for the most part (rather than trying to get it to look more like C for its own sake, a la mythryl)


It plugs into the existing OCaml compiler toolchain [1], which is quite smart. So it's basically an interface to OCaml that shares the stability and features of the OCaml compiler and runtime.

[1]: http://facebook.github.io/reason/#how-reason-works


I would rather say it's OCaml with a different syntax than a 'standalone language'.


Thought it was mostly summed up in the first paragraph... "Reason is a new approachable interface to the OCaml language, with the long-term goal of improving the developer experience by providing a functional syntax and toolchain for writing, building and sharing code quickly and easily."


I think the question was, what's the relationship between Reason and JavaScript?


It is a new syntax for OCaml but OCaml can compile to JS really well so Reason can too.


OCaml can be compiled to JavaScript. Therefore, so can Reason.


Looks like their plan is to reuse the ocaml compiler backends that output javascript; but it doesn't sound like they're doing anything explicit to promote Reason -> Javascript compilation.


Well, if you ignore the red button that runs you through comparisons of different Javascript syntax to the equivalent Reason syntax, then sure, they aren't doing anything explicit...


That's a comparison of syntax, which has nothing to do with compiling to Javascript.


Whether they have an intermediate step that is OCaml or not is irrelevant. Most compilers have one of more intermediate representations between source and executable. I think providing a syntax comparison to Javascript right next to a syntax comparison to OCaml is a clear indication that they are marketing to Javascript programmers, and the only reason for that is if they intend thelanguage as a replacement or supplement to Javascript.

That may or may not seem relevant to you based on ciniglio comment, but I think it's on point if you follow the thread from it's source down.


In 2016, "marketing to JavaScript programmers" is pretty much the same thing as "marketing to programmers". Providing context that the vast majority of programmers will understand is helpful regardless of the compilation strategy. That being said, of course people want a language that can compile to JavaScript, and it's worth mentioning the expanding set of options for doing so. But the syntax comparison really would be worthwhile even if it weren't the case, if only to provide context to what is likely the largest developer community that exists today.


The same as the relationship between OCaml and JavaScript, plus some braces.


I think it's a new frontend for the OCaml compiler. Allowing reuse of the backend / similar semantics, but with different syntax.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: