
10 Dec
2009
10 Dec
'09
5:07 p.m.
2009/12/10 Sebastian Sylvan
I think laziness requires purity to make sense. Laziness implies that the order of evaluation is highly unpredictable and depends strongly on the implementation details of libraries and such (which you may not have access to). So it's fickle. Someone adds an if statement somewhere and all of a sudden a variable gets evaluated earlier than it used to. It would be madness to write any code which depends on this unpredictable behaviour. In other words, the expressions that get evaluated lazily must not have side effects. -- Sebastian Sylvan
+1 This unpredictability has bit me a few times when using LINQ (which is awesome and has lazy evaluation) with C#. -- Deniz Dogan