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.

Melange 1.0: Compile OCaml / ReasonML to JavaScript

195 pointsby anmonteiro90almost 2 years ago

17 comments

pbiggaralmost 2 years ago
When we (darklang.com) were working with Rescript, I was not optimistic about Melange&#x27;s approach, but in retrospect I think it has legs.<p>The challenge with ReScript is that the authors really were focusing on the JS ecosystem, and didn&#x27;t care at all about OCaml. Their fusion with the ReasonML community didn&#x27;t make a whole lot of sense. ReScript is a much better language now that it has split than it was then, if you look solely through the lens of a better JS.<p>But, as Elm and other compiled-to-JS languages have learned, Typescript has gotten good enough that other languages might not be sufficiently better than TS to attract enough interest to have a vibrant community. Doubly so since the JS-interop story isn&#x27;t nearly as good in ReScript as it is in Typescript (though it&#x27;s much much better than in Elm).<p>However, the aim of writing programs in OCaml which compile to nice JS and also native OCaml, and allowing both client and server to be written in OCaml, remains valid and interesting (and I would argue was held back by js_of_ocaml, the pre-existing way to do it). So I think there is something interesting here, though it isn&#x27;t a ReScript competitor except tangentially.<p>Though I cannot really understand where ReasonML (a JS-like syntax for OCaml) fits into this - if the target is OCaml devs, than surely the ReasonML syntax stuff is not valuable anymore?
评论 #36298151 未加载
评论 #36298133 未加载
评论 #36300278 未加载
评论 #36303452 未加载
tyleragalmost 2 years ago
In the unlikely event you are confused on the difference between ReScript, Reason, and ReasonML, I recommend this post:<p><a href="https:&#x2F;&#x2F;ersin-akinci.medium.com&#x2F;confused-about-rescript-rescript-reason-reasonml-and-bucklescript-explained-ab4230555230" rel="nofollow noreferrer">https:&#x2F;&#x2F;ersin-akinci.medium.com&#x2F;confused-about-rescript-resc...</a>
评论 #36297698 未加载
Weebsalmost 2 years ago
I have nothing to say other than thank you! I might not use OCaml often myself, but I appreciate the effort to improve the ML ecosystem in any way :) I was a bit disappointed with the ReScript fork abandoning the compatibility with OCaml so this project was welcome news
评论 #36298326 未加载
评论 #36297933 未加载
评论 #36303766 未加载
k__almost 2 years ago
As if the whole Reason&#x2F;ReScript story wasn&#x27;t complicated enough already :D<p>First, we had BuckleScript, that compiled OCaml to JavaScript to bring the OCaml type system to the Web.<p>Then we had Reason, that brought JS syntax to OCaml, so it&#x27;s easier to grasp for JS devs.<p>Seemingly, some people didn&#x27;t care about OCaml at all, and forked (I guess?) Reason to ReScript, that focused on JS compilation. They also added a few syntax changes in the process.<p>Now, the remaining (pre-fork) Reason people created a new(?) compiler that&#x27;s an alternative to BuckleScript, and compiles OCaml and Reason to JS.<p>While I appreciate the effort, and think ReScript and Reason are superior to TypeScript, I totally understand why it didn&#x27;t get as popular as this superiority implies.
评论 #36303157 未加载
评论 #36306266 未加载
评论 #36303904 未加载
Mimmyalmost 2 years ago
Might as well ask this here, but any thoughts on how ReScript &#x2F; ReasonML compare to Elm, PureScript, or ClojureScript? If someone were looking for a fp language that compiled to JS, how would they think about the pros and cons of the available options?<p>Last discussion I could find was from 2018 [1].<p>[1] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=17910069">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=17910069</a>
评论 #36300682 未加载
评论 #36306131 未加载
评论 #36307104 未加载
sp33der89almost 2 years ago
What is the status of ReasonML? My first experiences with ReasonML were very nice, because I found OCaml syntax confusing. I kinda left around the time ReScript got introduced. But OCaml syntax after a while isn&#x27;t that bad, and in F# and Scala land I do miss the compile time speed of OCaml.
评论 #36297697 未加载
评论 #36297675 未加载
fredrikholmalmost 2 years ago
First multicore, now this? This makes me really happy.<p>OCaml is the most fun I&#x27;ve ever had writing code; seeing this after the whole Re* rebranding death spiral makes me hopeful that fullstack OCaml is still a possibility.<p>Thank you!
评论 #36301228 未加载
asycocamlalmost 2 years ago
Can someone please expain the state of doing async with Melange? ReasonML never had an answer in that important area to my knowledge.
评论 #36304622 未加载
idkjsalmost 2 years ago
Great new. Congratulations to the Melange team. Keep on keeping on.
emmelaichalmost 2 years ago
Just a note, melange is also the name of a computer language workbench from INRIA (<a href="http:&#x2F;&#x2F;melange.inria.fr&#x2F;" rel="nofollow noreferrer">http:&#x2F;&#x2F;melange.inria.fr&#x2F;</a>) and an APK builder (<a href="https:&#x2F;&#x2F;edu.chainguard.dev&#x2F;open-source&#x2F;melange&#x2F;overview&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;edu.chainguard.dev&#x2F;open-source&#x2F;melange&#x2F;overview&#x2F;</a>)<p>Both of those came up before melange.re when searching for a hello world example.
评论 #36304197 未加载
ekoszalmost 2 years ago
Interesting to see oh this will affect (or not) the Rescript project.
评论 #36297416 未加载
评论 #36297514 未加载
danieloro515almost 2 years ago
Thanks for putting the time and effort into this. I was very sad to see the departure of rescript, so I am happy to see this wonderful toolchain back to the Ocaml ecosystem.
cassepipealmost 2 years ago
Congrats on the releases ! I have been waiting for this make it to 1.0 for some time now. That&#x27;s a pleasant suprise.
js_of_ocaml_3almost 2 years ago
A lot of the ecosystem is written in TypeScript (heavy on structural typing). Last I&#x27;ve checked OCaml still doesn&#x27;t have substructural row polymorphism or set theoretic types, so this seems to be a futile endeavor until underlying fundamentals in its type system are addressed.<p>Elm &amp; PureScript I believe solved this problem.
评论 #36300384 未加载
评论 #36300718 未加载
thangngoc89almost 2 years ago
Congratulations on the project @anmonteiro90. Reading the thread makes me understand more about the situation of Rescript and ReasonML after the split. It’s totally makes sense now. I hope to pick up some OCaml project soon
gdsdfealmost 2 years ago
this is all very confusing
colesantiagoalmost 2 years ago
Do I need OCaml installed to use this, why not a single binary?
评论 #36297574 未加载