3 ms·
I can see why objects and closures are reducible to each other. As a Java dev who's written listener objects, closures seem like simple sugar to me. They hold
by jayd16 6y ago
I can see why objects and closures are reducible to each other. As a Java dev who's written listener objects, closures seem like simple sugar to me. They hold private state or references to state. Functions can be passed references to mutable data so they are equivalent as well.
However, there is the concept of a pure function (one that is unaffected by and causes no side effects) which I think can be argued is fundamentally different.