Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Module functors vs. records-of-functions for interface/implementation separation

$
0
0

I think I’d stick to module functions for such use cases, I’m not sure first-class modules and function records bring any benefit here. In general try to use the least powerful tool for the job.

It’s hard to judge without having the big picture of what you’re actually trying to do, but I’m pretty sure you could use a much simpler setup.

Simply passing functions instead of records of functions returning first-class modules make things much simpler to read and allows to know exactly the dependencies a given function has. If you’re not cautious, you could end passing around a huge “dependency root” you’d only use a few percents of in a given function and I think it’d then be pretty hard to tree-shake.


Viewing all articles
Browse latest Browse all 2592

Trending Articles