3 ms·
> A closure is an object that supports exactly one method: "apply". What's more, this enforces good object-orientation: this is a reimagining of the single-res
by copsarebastards 11y ago
> A closure is an object that supports exactly one method: "apply".
What's more, this enforces good object-orientation: this is a reimagining of the single-responsibility principle because closures are objects that literally do one thing.
Closures also enforce the open-close principle. Once it's closed it's closed.
The result is that you get a lot of good OO practices for free.