Alan Kay: Worlds: Controlling the scope of side effects [pdf]
vpri.org
vpri.org
import OutsideWorld (keyA, keyB, unlocksSafe)
unlockSafe = do
key <- [keyA, keyB]
if unlocksSafe key then return key else mzero
Of course, in Haskell, this would be more idiomatically solved simply using filter; but it's a toy example after all.You could always persist side-effects until later use. That's what closures allow you to do. However, what the paper introduces is a new kind of "versioned memory"; Think of it as copy-on-write for the process' RAM, where certain procedures can make all the global side-effects they desire and keeping the changes only visible to themselves. Not only that, but it keeps a journal of state-change, so you can track how a particular variable changed over time.
At least that's my understanding of it.