
On Dec 30, 2011, at 10:34 AM, Artyom Kazak wrote:
Gregg Reynolds
писал(а) в своём письме Fri, 30 Dec 2011 17:23:20 +0200: Regarding side-effects, they can be (informally) defined pretty simply: any non-computational effect caused by a computation is a side-effect. I wonder: can writing to memory be called a “computational effect”? If yes, then every computation is impure. If no, then what’s the difference between memory and hard drive?
Great question! It suggests that the line between computation and its side effects is not as clear-cut as we (well, I) thought. It relates to that while loop thing in my last reply to you, I think -
On 30/12/2011 15:50, Gregg Reynolds wrote: the computational effect dressed up as non-computational. We can do some work in Haskell using a temporary file on disk as a pragmatic solution to a space issue. We can feed that composed IO action to unsafePerformIO without breaking referential transparency, at least if we choose to ignore issues like running out of disk space (we ignore similar memory issues all the time). And really, it's just explicit virtual memory - it's implicitly happening in the background anyway. Or - it's layers of abstraction. The implementation of a function that uses explicit virtual memory is impure, but the abstraction it provides is pure. At least in principle (hand-waving away possible disk errors etc), the abstraction doesn't leak impurity.