4 ms·
I didn't realize Reason was so geared towards React. Would it be foolish to use an alternative like Vue with it? What about server-side with Node?
by kbd 8y ago
I didn't realize Reason was so geared towards React. Would it be foolish to use an alternative like Vue with it? What about server-side with Node?
- nouveaux 8y agoReason itself is not geared towards React and it is a general purpose language. I emphasize React mostly because the original creator of ReactJS is involved in creating Reason and you can see that React was designed for a language like Reason. I do not think it would be foolish to use it with Vue and Reason is actively used with Node. For instance: https://github.com/reasonml-community/bs-express https://github.com/reasonml-community/bs-express There is a lot of work going into the backend for Reason and I'm pretty excited about this.
- fspeech 8y agoReason itself is an alternative syntax for OCaml. The developers have built great support for React but in principle you can do whatever you can do with JS.
- kbd 8y agoSo what's the deal with BuckleScript? The docs are really unclear on their relation and just call it a "partner project". But it's the actual compiler? Then what is Reason?
- fspeech 8y agoReason = syntax for OCaml. Bucklescript is a transpiler to js. You can use other transpilers if you want but Bucklescript is great and has tightly integrated support. The best way to experience it is to just follow the "npm install" instructions. It may be a little confusing since you install Bucklescript, instead of Reason, as Reason is a syntax that Bucklescript supports. The online playground works great as well if you just want to get a feeling about the language.
- crimsonalucard 8y agoCan bucklescript compile OCaml into js?
- fspeech 8y agoYes that is what it was designed to do. Of course if your code calls out to some library implemented in native you will need to substitute with the js equivalent. Bucklescript has special syntax for you to describe the FFI to js, like Typescript. Otherwise it is OCaml in classical syntax or in Reason.
- cies 8y agoThere is a reason-vue project (https://github.com/JasonShin/reason-vue https://github.com/JasonShin/reason-vue), but from my memories with Vue it is not a great fit for a statically typed language because a lot in Vue is "stringly typed" (which means that it is untyped and basically works by using the same/right string in your code, opening a huge opportunity for typo-bugs that a compiler cannot find). You may want to look into this project which is an alternative to the React ecosystem: an implementation of the Elm architecture in OCaml/BuckleScript (and thus Reason). https://github.com/OvermindDL1/bucklescript-tea https://github.com/OvermindDL1/bucklescript-tea > What about server-side with Node? Possible with Reason, yet compilation to native is also possible from Reason... This allows one to use really fast all-OCaml libraries. Like this HTTP server: https://github.com/inhabitedtype/httpaf https://github.com/inhabitedtype/httpaf