4 ms·
One of his comments kind of stuck out when I read it. ... but many object[s] are large enough to constitute a sort of global state all their own, blunting some
by cobrausn 15y ago
One of his comments kind of stuck out when I read it.
... but many object[s] are large enough to constitute a sort of global state all their own, blunting some of the clarity benefits of pure functions.
I think we've all run into (and probably coded) our fair share of objects that were basically this - there is only one of them, and it has a lot of state associated with it. I never thought of it before as basically just encapsulating global state into an object. It almost seems... unavoidable, or at least really hard to avoid.
Also this was hilarious.
As an extreme example, you can write a pure DrawTriangle() function that takes a framebuffer as a parameter and returns a completely new framebuffer with the triangle drawn into it as a result. Don’t do that.