
My intuition says that laziness and purity are distinct whereas yours says that purity is a necessary condition. This is what needs to be reconciled. I believe that everyone is thinking that lazy evaluation and strict evaluation are similar activities whereas they are profoundly different.

2009/12/10 John D. Earle
My intuition says that laziness and purity are distinct whereas yours says that purity is a necessary condition. This is what needs to be reconciled.
Mixing impurity and laziness makes code whose behavior is too hard to understand. So, there is no theoretical reason not to mix them, but there is a practical one.
I believe that everyone is thinking that lazy evaluation and strict evaluation are similar activities whereas they are profoundly different. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Eugene Kirpichov Web IR developer, market.yandex.ru

Yes I remember when watching Erik Meijer's videos on Channel9 he said
a similar thing: "laziness in the presence of side effects makes your
head explode"...
I guess the recent Microsoft Rx framework for .NET (that permits
impure push-based functional reactive programming with LINQ) will soon
show if the average software engineer can successfully combine side
effects with laziness... Imperative/OO programming is full of
guidelines to help the programmer avoid side effects: "use local state
as much as possible", "never use mutable globals", "use single point
of definition to avoid double out of sync data", "encapsulate
encapsulate encapsulate", etc
On Thu, Dec 10, 2009 at 4:38 PM, Eugene Kirpichov
2009/12/10 John D. Earle
: My intuition says that laziness and purity are distinct whereas yours says that purity is a necessary condition. This is what needs to be reconciled.
Mixing impurity and laziness makes code whose behavior is too hard to understand. So, there is no theoretical reason not to mix them, but there is a practical one.
I believe that everyone is thinking that lazy evaluation and strict evaluation are similar activities whereas they are profoundly different. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Eugene Kirpichov Web IR developer, market.yandex.ru _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Eugene, by purity do you mean effect free? There is a subtle difference. The
lack of effects makes a language functional, but this does not imply that
the language is pure.
--------------------------------------------------
From: "Eugene Kirpichov"
2009/12/10 John D. Earle
: My intuition says that laziness and purity are distinct whereas yours says that purity is a necessary condition. This is what needs to be reconciled.
Mixing impurity and laziness makes code whose behavior is too hard to understand. So, there is no theoretical reason not to mix them, but there is a practical one.
I believe that everyone is thinking that lazy evaluation and strict evaluation are similar activities whereas they are profoundly different. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Eugene Kirpichov Web IR developer, market.yandex.ru

You're right. I mean referential transparency.
2009/12/10 John D. Earle
Eugene, by purity do you mean effect free? There is a subtle difference. The lack of effects makes a language functional, but this does not imply that the language is pure.
-------------------------------------------------- From: "Eugene Kirpichov"
Sent: 10 Thursday December 2009 0838 To: "John D. Earle" Cc: "Haskell Cafe" Subject: Re: [Haskell-cafe] Re: Why? 2009/12/10 John D. Earle
: My intuition says that laziness and purity are distinct whereas yours says that purity is a necessary condition. This is what needs to be reconciled.
Mixing impurity and laziness makes code whose behavior is too hard to understand. So, there is no theoretical reason not to mix them, but there is a practical one.
I believe that everyone is thinking that lazy evaluation and strict evaluation are similar activities whereas they are profoundly different. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Eugene Kirpichov Web IR developer, market.yandex.ru
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Eugene Kirpichov Web IR developer, market.yandex.ru

Non-strictness is not necessary for purity, but it sure gives you some nice
properties... Take for example
const x y = x
It would be really nice for this function to have the property "always
results in x no matter what you give it as it's second argument". But for a
language which is strict, all instances where computing y non-terminates
also non-terminate.
So yes, non-strictness is very much a property you want in a language.
Bob
On Thu, Dec 10, 2009 at 3:30 PM, John D. Earle
My intuition says that laziness and purity are distinct whereas yours says that purity is a necessary condition. This is what needs to be reconciled.
I believe that everyone is thinking that lazy evaluation and strict evaluation are similar activities whereas they are profoundly different. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Thu, Dec 10, 2009 at 3:30 PM, John D. Earle
My intuition says that laziness and purity are distinct whereas yours says that purity is a necessary condition. This is what needs to be reconciled.
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

On Thu, Dec 10, 2009 at 11:56 AM, Sebastian Sylvan
On Thu, Dec 10, 2009 at 3:30 PM, John D. Earle
wrote: My intuition says that laziness and purity are distinct whereas yours says that purity is a necessary condition. This is what needs to be reconciled.
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.
Yes, this is discussed in section 3.2 of the paper I cited earlier (http://research.microsoft.com/en-us/um/people/simonpj/papers/history-of-hask...). That paper gives some nice insight into the history of Haskell.

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

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
Laziness is like single-threaded concurrency.
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.
I'm always amazed that shared-address space multi-threaded programs work at all. -k -- If I haven't seen further, it is by standing in the footprints of giants
participants (8)
-
Deniz Dogan
-
Eugene Kirpichov
-
John D. Earle
-
Ketil Malde
-
MightyByte
-
Peter Verswyvelen
-
Sebastian Sylvan
-
Tom Davie