5 ms·
There's nothing anti-functional in bundling related functions into an object. On the contrary, this helps with modularity, which is a good thing. You can then
by sideeffffect 4y ago
There's nothing anti-functional in bundling related functions into an object.
On the contrary, this helps with modularity, which is a good thing. You can then swap out the object for another object with the same interface, but where the functions (methods) have different implementations.
- galaxyLogic 4y agoAn often overlooked feature of OOP is the use of pseudo-variable 'this' (or 'self in Smalltalk). That is about name-scope. You can refer to your own method simply by its name via 'this', and when you call it you know it can access the state inside that particular object. Without 'this' an object in JavaScript and other OOP languages could not access its own properties including it (possibly mutable) state. Is there an equivalent to 'this' in purely FP languages?