有没有尝试向 Erlang 添加惰性求值?
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
我的问题是,有没有尝试向 Erlang 添加惰性求值,如果有,结果如何?
有几个人已经尝试过实现惰性 lists/streams 之类的东西,甚至将 Haskell 的子集编译到 Beam,但主要问题是 Beam VM 不直接支持完全惰性, 所以如果你想确保没有 thunk 被评估超过一次,你需要通过将结果存储在 ETS table 或类似的东西中来做到这一点,这会变得非常低效。
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
我的问题是,有没有尝试向 Erlang 添加惰性求值,如果有,结果如何?
有几个人已经尝试过实现惰性 lists/streams 之类的东西,甚至将 Haskell 的子集编译到 Beam,但主要问题是 Beam VM 不直接支持完全惰性, 所以如果你想确保没有 thunk 被评估超过一次,你需要通过将结果存储在 ETS table 或类似的东西中来做到这一点,这会变得非常低效。