3 ms·
It sounds to me like you're using classes to implement curried functions. In this case with the IO / DI context as the curried parameter. Working in functional
by zero_shift 3y ago
It sounds to me like you're using classes to implement curried functions. In this case with the IO / DI context as the curried parameter.
Working in functional langs I just do DI with higher order functions.
- slively 3y agoExactly! I find myself writing out the same code with classes and functions to show this to folks. I still prefer using classes as it’s easier for me to see at a glance that constructor = DI/curry vs a function returning an object of functions or something. So a class is just a way to communicate a pattern.
- galbar 3y agoI have definitely had the whole "what is the difference between this class <class with constructor and one method> and this function that receives the same as the class constructor returns a function implementing the method" conversation with my teammates before!