Search code examples
erlanglazy-evaluation

Has there been any attempts at adding lazy evaluation to Erlang?


Language features which make it hard(er) for programmers to roughly estimate performance were never added to Erlang. For instance, Erlang doesn't have lazy evaluation.1

My question is, has there been any attempt at adding lazy evaluation to Erlang, and if so what were the results?


Solution

  • Several people have experimented with implementing things like lazy lists/streams, or even compiling a subset of Haskell to Beam, but the main problem is that the Beam VM has no direct support for full laziness, so if you want to ensure that no thunk is evaluated more than once, you need to do this by storing results in an ETS table or similar, and that gets quite inefficient.