Replies: 3 comments 3 replies
-
There is a lot of power here but I agree for newcomers it's completely opaque. The ReScript community could use some good people writing tutorials! Yes this is all by design. ReScript is geared towards functional programming and modularisation, which means that attaching functions to objects in the OO style The thing to remember is that modules can be brought into scope so one option to achieve nice code is: open Document
document->getElementById("root") And if you look at the compiled JS the ReScript external magic produces This is why the reference is the first argument, so that pipe first can be written in a similar style to the JS approach. I like to say that with a bit of squinting it even looks the same, and Once a new developer can accept that, we then explain that generally you don't want the entire |
Beta Was this translation helpful? Give feedback.
-
I appreciate you responded, si it's both technical and functional style design, i can easily accept that kind of tradeoff in Rescript. |
Beta Was this translation helpful? Give feedback.
-
@TheSpyder EDIT: let container = Document.getElementById(document)("root") is there a way to curry all the module functions? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've read some articles about rescript and managed to setup rescript with webpack and react
I want in the future to make some tutorials on rescript, however i found some barriers when using the
rescript-webapi
moduleThe bigger downside i found for a newcomer like me were the differences between the javascript Dom api method signatures
In javascript making DOM operations follows:
the rescript counterpart requires passing the document reference as the first argument
is that by design? i think it's important to know why, because it requires more code, so i believe this has a justification
i'm okay with this extra document reference added signtures, the problem is that they can take some time to figure out, so whatever reason you had for making as it is, it's okay for me as well, i just want to make it easier for others like me coming from js.
While i believe this is not a big deal, i believe result in rapid lost of interest if someone is just taking a look an tries some basic dom manipulation and encounters some fancy syntax with different signatures, because it's less pragmatic (from the user perspective), even though in general rescript uses less code than the javascript counterpart.
Beta Was this translation helpful? Give feedback.
All reactions