r/functionalprogramming • • Jun 28 '24

Question Does Lazy Evaluation have a Future?

In Haskell it is used for deforestation to keep the stack low. But after some experience with it, it is simply a problematic concept.
UPDATE: What do you think about a concept with buds?
Buds that change from unbound to bound via a side effect,
which can be checked beforehand with isbound. Wouldn't a concept with buds be much more flexible.

2 Upvotes

20 comments sorted by

View all comments

Show parent comment

-1

u/metazip Jun 28 '24

... Is this the reason you're finding it problematic?

It can't handle side effects at all. It seems as if there shouldn't be any side effects, because then it is no longer guaranteed that lazy evaluation will produce a correct result. In addition, the data has an identity problem - you can't check references for identity.

7

u/faiface Jun 28 '24

What you’re describing now is functional purity. Pure functional programming certainly has a future. Side-effects and checking references for identity has its own host of problems.

Laziness everywhere forces functional purity, yes. But a pure functional language doesn’t have to be lazy. I think it’s very reasonable to have a pure language to avoid problems with side-effects, but not lazy to avoid problems with lazy evaluation everywhere.