Finally I am taking the time to learn ReScript. Follow me on my journey and read how I approach it, mixed with some of my opinions and experiences. He

Learning ReScript - Part 1 (Intro and Setup)

submited by
Style Pass
2021-05-24 13:30:06

Finally I am taking the time to learn ReScript. Follow me on my journey and read how I approach it, mixed with some of my opinions and experiences.

Here is my answer. JavaScript is amazingly flexible, but has short comings when it comes to big projects, complex structures, growing team sizes and growing code bases. Types have proven over time to be helpful. Tests are helpful too, but that is nothing that ReScript helps with, besides maybe reducing the need for a couple of tests.

ReScript rejects all incorrect programs (it is sound). It is a typed-first language[1] that compiles to JavaScript. It's designed from types and not mounted on top of JavaScript. It compiles to JavaScript, so it needs at least one compile step to be run.

[1] I wrote "typed-first language" above. As far as I know this is not a commonly used term, I just made it up (maybe it exists already, no idea). What I mean is, that this is a language that was created with types in mind at creation time. Things like exhaustiveness, soundness, preventing any-types and alike things that make a strong typed language powerful and prevent the bugs that untyped languages may come with, are baked in from the beginning. No worries, therefore one can learn to make new mistakes ;). Languages or type systems like flow or TypeScript have to deal with baking it onto the language, so they have to handle the complexity of the underlying language, JavaScript. That's why I would name ReScript typed-first.

On the docs install page it's suggested to clone an existing repo and go from there. I prefer to follow the instructions how to set up my own repo and add ReScript from scratch, if you also want to do that, follow the next chapter of the docs, the integration guide.

Leave a Comment