Fork me on GitHub
#duct
<
2019-09-30
>
jahson07:09:20

It depends. If the function can be viewed as a module and it is used in many places — you can make it just like the handler example, i.e the multimethod that takes the dependencies and returns a function that closes over these deps. After init the system will contain this function and you can provide it as a dependency where needed. At least you should be able to do something similar to this. If the function is used in one place, I think there's no need to define it as a module.

rickmoynihan09:09:43

@jjttjj: No, it’s like @jahson says. You should never typically access the system directly; except calling halt to shut it down, or in a dev/debugging/testing context. The whole idea is that components are injected with precisely the dependencies they need. Those dependencies include other instantiated components. I’d avoid calling these things modules though, they’re integrant components. Modules are something very different.

jahson11:09:08

> I’d avoid calling these things modules though, they’re integrant components. Modules are something very different. Yeah, my bad.