Now that ReScript is able to focus on optimizing for the JS use case and not “held back” by OCaml compatibility anymore, shouldn’t we consider making uncurried calls the default?
Of course this would be another breaking change, and I don’t know the implications it would have in the compiler, but it would bring the following improvements:
- Better performance and simpler JS code: No more
Curry._1(...)
calls in the generated code that cost performance, especially when they happen in the hot path. - Therefore no more need for manual performance tuning for such cases, which is a pain anyway, as making a function uncurried requires changes to all the call sites.
- Make things easier for beginners who sometimes struggle with problems where they are inadvertently calling a function with one or more arguments missing.
- Simplified JS interop - no more need for
bs.uncurry
etc. - If everything is uncurried by default, we can also get rid of the Belt
forEach
vs.forEachU
etc. distinction.
We could simply flip the current .
syntax, i.e. if we have a function f
, then f(a, b)
would be an uncurried call, meaning that the function would need to have exactly two parameters, whereas f(. a)
would mean a curried call (partial application of f
).
Not sure if the latter would be needed at all though as you can always just spell out the closure b => f(a, b)
.
What do you think?