3 ms·
The number + 1 or x 1 doesn't require an object or oop. It doesn't require a function either and would be better to just inline. The great thing about repurpo
by wolco 6y ago
The number + 1 or x 1 doesn't require an object or oop. It doesn't require a function either and would be better to just inline.
The great thing about repurposing a class as a namespace is I can pass that repurposed namespace package anywhere.
You never need to change their code either inject those objects into a new class or extend one and inject the other.
- leafboi 6y ago>The great thing about repurposing a class as a namespace is I can pass that repurposed namespace package anywhere. namespaces can be passed anywhere anyway. >The number + 1 or x 1 doesn't require an object or oop. It doesn't require a function either and would be better to just inline. + 1 and x 1 are just examples. If you take the examples and make it more complex the problem still remains. An inlined expression is still a function. It's just not named. y = function(x){return x+1; b1 = 1 + y(2) x = 2 b2 = 1 + (x + 1) In the above code y(2) and x = 2; x+1; are equivalent. >You never need to change their code either inject those objects into a new class or extend one and inject the other. You rarely ever need to do this in FP, but you need to do this all the time in OOP.