Let’s say I have 3 modules. Each has private and public functions. Now let’s say I have a private function in each module that does the same thing (same code). I don’t want to update 3 identical private functions. Instead, I want to share one private function between the 3 modules.
- Create a "Helper" module that becomes a dependency to the other 3 modules, but I want the functions in Helper to be private and I'm not sure how a module can access a private function from another module.
- Create a "Helper" module but the private functions are public instead. This method would defeat the purpose of keeping the functions private.
- Add some logic to each module when loaded to dot source a script file that contains the private functions. This idea does not settle well with me and seems counterproductive especially with a DevOps approach.
- Bite the bullet and deal with identical functions. Even more counterproductive.