Hidden Dependency
↔ External outer scope variable or invoking external function
Hidden Dependency can be moved into input Argument to turn into Pure Function
function add(a, b, c, log) {
log(a, b)
return a + b + c;
}
package & defer impurity to inner function
function addFunc(c, log) {
function add(a, b) {
log(a, b)
return a + b + c
}
return add
}
References
Side Effect
↔ Effect with external Hidden Dependency that read/writes to External System