-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add blogpost about uncurried mode #714
Add blogpost about uncurried mode #714
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent post! Thanks a lot! 👍
```rescript | ||
(. param) => () | ||
``` | ||
* As ReScript could not fully statically analyze when to automatically uncurry a function over multiple files, it led to unnecessary `Curry.` calls in the emitted JavaScript code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can clearly state here than function calls in uncurried mode are now guarantied to get compiled as simple JS function calls, which is quite nice for readability of the generated JS code but also for performance (even though it was not that significant) and sometimes even correctness when applied on bindings (Curry
sometimes badly played with this
and other JS features we don't care about in rescript).
Not sure it's worth being publicized but now you can even bind classes to simple rescript records which are sometimes much nicer to use than using an opaque type and a function:
myLogger->Logger.info("foo")
// vs
myLogger.info("foo")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I am not sure about the class suggestion either. I only added your first point.
function calls in uncurried mode are now guarantied to get compiled as simple JS function calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you maybe give me a full example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(f) => f()
is an example.
Or a more realistic example using that pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I should have clarified I meant for classes as records.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything more to add now. Great job @fhammerschmidt!
No description provided.