News for hackers. Stuff that matters.
Re:Monads as a Programming Pattern by charmonium on Monday August 12, 2019 @09:56PM (#20682126)
What exactly do you mean by stateless? Encapsulation in the OOP sense is not stateless, because two identical method-calls may not return the same value. Example: if you have an ArrayList, calling `size` at one point in time might have a different result than calling `size` now. That's why I say the list 'remembers' its 'state'.

An object wrapper has to have the object somewhere in memory, you just can't touch it. With a monad, the object might not even exist yet (example: Promise) or there might be more than one (example: Collections).

There are no comments on this comment yet.