DEV Community

Discussion on: Where Did All My Methods Go? Modules in ReasonML

Collapse
 
johnridesabike profile image
John Jackson

Nice explanation. One thing I personally like about using the Js module is that it compiles to native JS methods.

myArray |> Js.Array.map(x => x * 3);

turns into:

myArray.map(x => x * 3);

If you use Array or Belt, then the JS output will import functions from the Bucklescript library and use those instead. I'm assuming there isn't much of a difference in the end, but why import extra functions if you don't have to?

Collapse
 
hagnerd profile image
Matt Hagner

That's a really good point especially if you're targeting JavaScript. I'm hoping to dive more into the differences between the modules, and what the benefits of each are. It doesn't seem like the community has fully decided on which is the defacto set of modules to use, and at first the differences seem rather small, but I've noticed there's quite a bit of nuance.