ReScript 8.4
rescript-lang.org
rescript-lang.org
For those now familiar with ReScript, ReScript started as "reason" an alternative syntax for Ocaml. Recently ReScript was created with a sytnax more similar to TypeScript than "Reason". In addition, there is a fork of OCaml for compiling to javascript that used to be branded as "Bucklescript", but now it is called "ReScript" as well.
So now as of 12/14/2020 there are three Ocaml syntax versions in use:
Ocaml, Reason (Reason 3.6, last version available for native code) ReScript, (~Reason 4, only available for javascript compiler fork, some sytax present in Ocaml/Reason has actually been removed with no equivilant in the grammar)
I am not sure who benefits from this, Ocaml is a serious language that will never be as simple as a dynamically typed language. I am not sure who this is supposed to be helping. It seems to me that things were more clear a year ago when there were just two syntaxes available. In addition, it now takes a relative subject matter expert to disipher what is going on, which i think is the exact outcome ReScript was trying to avoid.
This is how I understand this:
1996 - OCaml is born.
2016 - ReasonML, an alternative syntax that compiles to OCaml, is launched by Facebook.
2016 - A couple of months later, BuckleScript, an OCaml -> JS compiler is launched.
201X - Collaboration happens, BuckleScript couples tightly to ReasonML.
2020 - BuckleScript forks the ReasonML syntax and rebrands the compiler and the new syntax together under ReScript.
2020 - ReasonML still exists?
Ok, fine. What is not clear to me is how the Facebook team behind ReasonML fits into ReScript. Are they aligned on the direction to take this community? What is the future of ReasonML?What was the goal? If it was to ease adoption by newcomers, as a newcomer, it has made this more difficult. As someone VERY EAGER to enter this family of languages today, I ended up giving up on all of that and decided to just learn OCaml.
Now I'm dealing with Dune, Esy, OPAM, two competing async libraries and a community that is split between Jane Street libraries and the others.. but I really, really like OCaml!
This was my exact path. A friend and I wanted to make a small SaaS using Reason for the backend, because it smoothed out a bunch of what we considered were "rough edges" in OCaml. Then the ReScript split happened, and we realised that Reason was dead for all intents and purposes. It's hard to imagine the Reason team will continue updating Reason when they're focusing hard on ReScript instead.
From the same source, I heard ReScript does have funding behind it.
There was actually some effort being made to keep OCaml tooling compatible with ReasonML (which is supported by dune[0] with no additional configuration) and BuckleScript integration with dune, which was being worked on before this rebrand, so it's kind of sad to see FB going off on their own with ReScript because they don't wanna do the work to upstream the changes they need.
By the way, regular OCaml also has its own JS backend[1] which is of course completely incompatible with BuckleScript.
0: https://dune.build/ 1: https://github.com/ocsigen/js_of_ocaml
ReScript is not a Facebook project. The compiler is licensed by Bloomberg LLP: https://github.com/rescript-lang/rescript-compiler/blob/60a1...
And the syntax is licensed by the ReScript team: https://github.com/rescript-lang/syntax/blob/72d9b7034fc28f3...
The ReScript team is comprised of both Facebook and folks outside Facebook.
- Reason+BuckleScript was confusing at best, having two websites and different release schedules.
- Reason's goal is to be a 100% mapped syntax for OCaml. This does not mesh well with the goal of producing readable JS, so ReScript will probably end up as a subset of OCaml features.
- Reason syntax changes apparently caused grief when applied to BuckleScript. This one was never very clear, but regardless now that the syntax is in-house the ReScript team can be more responsive with it.
The problem with this transition is that it was dropped on the community in an unfinished state and BuckleScript was retired completely. The goals of the change are, I think, mostly reasonable.
Purescript also shares this goal, and it is a bummer, performance-wise, in older browsers that don't handle currying and various other "readable" representations well.
Worse still, if your target output is readable, then someone might start touching the compiled runtime objects with Javascript and then... god help you as you watch the guarantees of your fancy type system unravel before your very eyes.
https://rescript-lang.org/docs/manual/latest/shared-data-typ...
- Uncurrying functions
- Compiling OCaml modules to idiomatic JavaScript objects
- Compiling OCaml record values to idiomatic JavaScript objects
- Compiling tail recursion to idiomatic while loops
- And so on.
> someone might start touching the compiled runtime objects with Javascript and then... god help you as you watch the guarantees of your fancy type system unravel before your very eyes.
That's exactly what genType is for--it produces JavaScript, TypeScript, and Flow interfaces for ReScript output code so that people in the JS world can consume it transparently.
I am rather disappointed and think F# 's Fable is a better alternative.
Here is a react binding for jsoo: https://github.com/jchavarri/jsoo-react .
I hope something good does coalesce, but it's currently very confusing. Maybe just me but the opportunity feels like it's slipping away. As say, been following things very closely so I fully appreciate some the issues & understand some hidden things are based on internal needs of that part of FB
[0]: https://github.com/revery-ui/revery [1]: https://onivim.io/
Anyway, there was already a problem with like three different standard libraries (which had super annoying differences like swapping parameter orders, presumably in an attempt to be friendlier etc.) or something when I first messed around with ReasonML (Bucklescript? Whatever the Facebook one was in 2019? I dunno.) and I hope this isn't also increasing that problem ?
Now that ReScript has superseded ReasonML+Bucklescript, the only niche remaining for non-legacy ReasonML is native development work by folks who just don't like the normal OCaml syntax, or want to target both runtimes with the same code.
Basically, the permutations are like this, with "ReScript (backend)" referring to the thing formerly known as BuckleScript:
OCaml/native: What normal people think of when they hear "OCaml".
ReasonML/native: Uncommon, but supported for folks who've bought into the Reason syntax.
ReScript (frontend)/native: Nobody does this since ReScript is strictly worse than ReasonML when targeting native. I don't even know if it's possible.
OCaml/ReScript (backend): Should be possible, but nobody does this.
ReasonML/ReScript (backend): Sort-of-deprecated in favor of the new syntax, but still supported, and most pre-existing projects are probably still using this.
ReScript (frontend)/ReScript (backend): Now collectively known as "ReScript" and the focus of the team going forward. New web projects are expected to use this.
I can think of: TheActualStdlib, Base/Core_kernel/Core, Batteries, Containers, Belt, ...
Now it seems like it's a complete fork with a new syntax. Maybe it serves the interest of people at facebook, but Ocaml users are unlikely to be using this instead of js_of_ocaml.
I feel like this fork might make sense inside Bloomberg, but it’s killed my enthusiasm for this language family.
The messaging isn't clear on ReasonML's future at ALL though. Is it essentially deprecated until the full switch to ReScript happens? The Rescript FAQ mentions changes will be additive in supporting ReasonML, and they will track new features to OCaml, but will they track new features to Reason? Will anyone actively develop Reason anymore?
The success of BuckleScript meant that a _lot_ of people used what they thought was ReasonML but it was really ReasonML+BuckleScript. This lead to a ton of confusion the moment newcomers realised they needed a second website to look up APIs.
ReScript includes a snapshot version of ReasonML for backwards compatibility, but it will never be upgraded.
The future of ReasonML is likely slow and steady progress, potentially fading into obscurity as the target audience is now very small (OCaml developers who don't like OCaml syntax).
To write the same code for both front and back end js_of_ocaml has been the standard since long before Reason came along, and it works just fine with Reason native.
To have code that you can compile to both native and js, the easiest thing is to stick to the ocaml syntax. It is supported by all the versions of the compiler (rescript or ocaml). And to also use the ocaml syntax for the tools doing code generation, such as atdgen.
I was searching for this recently and came up short... Is it mainly being used inside Facebook?
Kind of a shame as the ideas look good. I would like something like Elm, but Elm doesn't interoperate with JS.
You can try Mint: https://www.mint-lang.com
I've created it because I wanted something like Elm but with easier JS interop and less boilerplate :)
Thanks :)
> Do you have a roadmap?
It's no written roadmap yet, currently I'm working on a UI library which is written in Mint, and these are things which the majority of people want which I'll work on next:
- Language Server
- Server Side Rendering
- Interfacing with NPM libraries
- Some new language features and cleanup of some of the existing ones
- A proper Time module
After those I think we can release 1.0 and focus on bugfixes and optimizations.
[0] https://github.com/Zaid-Ajaj/Feliz [1] https://github.com/Zaid-Ajaj/Fable.Remoting
https://www.tiny.cloud/blog/tinymce-reasonml/
We aren't sure when we will be able to open source the new model, and we are still using Reason syntax with the ReScript compiler, but we will transition to ReScript syntax eventually.
Is that true for ReScript, or no?
Presumably Facebook still uses React? But they use it via regular JS and not Reason or Rescript?
I do have to concur with some of the comments -- the situation seems pretty confusing, and spending a bunch of time looking at docs didn't enlighten me.
It probably explain why fb dedicates so little resources to reason too.
This issue is trying asking for some explanation regarding the future of ReasonML. Maybe comment/react/subscribe to stay up to date on this issue!
Also OCaml in Windows was hard to configure and get right. The barrier to entry into the ecosystem is huge and it has to be resolved. The language is beautiful but anyone needs to be able to get productive in it very quickly.