ReScript aims to be a strictly typed JS, simpler and faster than TS
rescript-lang.org
rescript-lang.org
- OCaml is a functional, object-oriented and statically typed programming language that compiles to binaries and bytecode. It's a ML (Meta Language) descendant, like SML for example
- js_of_ocaml is a compiler that takes in OCaml bytecode and outputs JavaScript
- BuckleScript is a compiler that takes OCaml code and outputs JavaScript
- ReasonML is an alternative syntax for OCaml. ReasonML code can be compiled to binaries like regular OCaml code.
- BuckleScript and ReasonML were used together often
- ReScript is a new language that's based on the OCaml compiler, BuckleScript, and ReasonML syntax. ReScript targets only JavaScript and has a
A post on the history of ReScript/BuckleScript in the OCaml forum: https://discuss.ocaml.org/t/a-short-history-of-rescript-buck...
I really wish them success (I'd LOVE to live in a parallel universe where this is the default web language), but it seems like whoever is responsible for attracting developer mindshare is completely clueless.
From how I understand this, ReasonML was/is the true OCaml derivative in JS world.
Whereas Rescript, which was called BuckleScript I think, took the nice pattern matching bits along with the type system from OCaml and married it into JS syntax.
That said, they’ve further tweaked the syntax from BuckleScript days presumably and removed support for JS classes.
Unfortunately, it looks like not much has changed[0], and you’re still forced into writing the equivalent of unwieldy Promise chains.
I ended up migrating us onto Typescript, which was a great move for us. The seamless interop with JavaScript combined with the massively active community makes it a no-brainer over other attempts at strongly-typed JS, IMO.
That said, I get that there's callbacks for everything and that you can do I/O with callbacks but it's not fun and if that is your only option you're going to need some external Flux "store" to manage all your state.
Edit: I should also add that I understand that there are people who find the async/await paradigm to be bad but I don't think we have much of an alternative when it comes to JavaScript or if you want an alternative, we'll then you are hardcore enough to be fine with just callbacks.
I remember needing to navigate between BuckleScript and ReasonML docs (which were terrible at the time) to make sense of the available standard library.
Obviously wrong, but funny, stuff I found when I tried to search:
1) Real Estate Structured Finance
2) Rat Embryonic Skin Fibroblas
3) Resilient File System (still didn't make sense, but at least it's IT-related)
Again, thanks to those who posted the real acronym!
I'm interested in porting my current sideproject over. Does anyone with experience know how interop might work with a hooks library like react-aria[1]?
You can have a "simpler" type system yet still end up with an overall less convenient DX. As for "faster", really who cares. I feel that these people in big tech who comes up with these stuff, with their massive codebases, have different pain points to most of us.
The fact that they spent the last how many years changing syntax around doesn't give a good impression on priority either. To be fair, this whole thing started as an OCAML syntax, which is a questionable motivation in the first place.
But you are right, using JS/TS libraries is a huge pain point. It really needs a binding generator for typescript files.
Not having async/await wasn't such a big deal for me.
Last time I tried Rescript, it felt like I was isolating myself on an island away from the greater ecosystem. But I don’t think I gave it enough of a chance. I admire the vision, and I’m rooting for the team. And who knows, perhaps a Svelte component with Rescript in the script tag could be the new pinnacle I didn’t know I wanted!
Wait! This is not new. This is Ocaml disguised as JavaScript... It is based of BuckleScript and Reason.
Stuff I've considered in the past. Note sure if I will ever use it but okay. Interesting...