Hi,
I just recently discovered ReScript - I absolutely love the idea of it. I’ve been through more languages than I can recall, but Ocaml isn’t one of them. For me, ReScript is a mix of Rust and Groovy, sort of.
It resonates with me as I’ve been looking for a more rigorous, concise and efficient language with accompanying toolkit for the Node.js domain.
There are a few things that I either do not understand or have some issues with:
-
Array mutability
I don’t understand why arrays are mutable in ReScript. Can someone explain the rationale? I mean, it would make sense for me if they were mutable if marked as such, but otherwise - why not default to immutability both when it comes to assignment but also in terms of array contents? -
JS Interop
Right now, whenever I pull some JS lib into my projects, I have to wade through tons of information. Not because I don’t know the lib API - but because I haven’t memorized each exact type. Just do do a simple app with Mongoose, for example - setting up the schema, connecting to the database, using it properly and inserting or retrieving documents - I have to set up so much typing.
.
I understand this is true for TypeScript as well - however there is a significant difference, and that is that I don’t have to setup the typing. I can use it without typing, which makes my life so much more easy. I know there’s some method called connection, I know there is a connection with some readyState on it, I know there’s a findOne method - but I don’t recall their exact signatures. But I recall them to the point where I can use them in JS without ever looking at the documentation. Forcing me to type everything means killing my efficiency by 90% or so. Am I doing something wrong? -
Interop verbosity
I was looking to do some React with ReScript. The experience is, most of the time, better than JSX/TSX. I can probably live with React.string everywhere (although I would prefer to not have it, but I don’t know what the plans on this are). What I can’t live with is seeing something like React.ReactForm.Event.target(e)[“value”] instead of e.target.value. It’s just not feasible for me - it’s not slightly overly verbose, it’s WAY, WAY too verbose for me to live with. I could probably live with e->eventTargetValue (which I know how I can define easily as a layer in between). Am I thinking about this wrong, or what I am missing? I think I would like some kind of “relaxed interop mode” - but maybe that I was %raw is for?
.
If this cannot be addressed, I think it might become a sort of friction for the community in terms of adoption.
PS. Thank you for an absolutely amazing toolchain and language. The speed of the compiler and the simplicity of setting everything up, and the fact that you can go file-by-file when migrating makes it so much more easier to use.