It's a functional language that compiles to JavaScript (or to OCaml).
Nowadays ML usually stands for Machine Learning, but in the old days there was a programming language called "Meta Language" which is the ancestor of ReasonML, or Reason Meta Language.
ReasonML is compatible with both JS and OCaml, but lately it was mostly used in the JS ecosystem.
ReScript takes JS-related things from Reason and stops being limited by OCaml support.
All references are actually constants. Shadowing is widely used. Standard library functions are non-mutative and produce new instances if any changes are made. There is a workaround to create a mutable reference if needed but deliberate enough to be discouraging.
ReScript is a functional language with no methods on objects, but you can call and chain functions in a familiar way with piping and currying, like
myList->List.length
or
myArray->Array.map(item => item * 2)
This is probably the main reason to choose ReScript. It has strong type system and powerful type inference, so you are rarely required to explicitly define types, but the compiler always know what the types are
This is a case in many languages, but coming from Java I really appreciate this feature
It's very easy to describe any domain with the custom types
You can create type aliases like `type eventId = string` or complex types like
type event = {
id: eventId,
name: string,
uniqueName: option<string>,
description: string,
properties: list<property>,
types: list<eventType>
}
It's accompanied by an empowered kind of enum called variants. There are options of variants with and without duck typing. Better to see it in action https://tinyurl.com/yv4nfpkm
It's possible to start writing code after just a few hours of learning if you already know another programming language
The combination of a rigid type system and exhaustive switches make the compiler very efficient in finding bugs in the compile time
There is not much syntax sugar, for example to unwrap an optional constant you'd have to write `maybeSomething->Option.map(something -> something->performOperation)` instead of `maybeSomething?.performOperation()` in some other languages
Yes, like in good old C
Having a powerful compiler that catches 99% of the type bugs can be too relaxing and it becomes easier to miss that one occasional bug that slips through the compiler checks 😉