[erlang-questions] effect of destructive updates on GC implementation
Wed Jan 30 01:20:14 CET 2008
I'm not suggesting that all funs be so optimized. There would be a
specific syntax, and you have to understand the semantics and know
what you're doing.
2008/1/29 Mihai Balea <>:
> On Jan 29, 2008, at 5:11 PM, Jonathan Amsterdam wrote:
> > How about promises with memoization? That is, a no-argument fun whose
> > result is cached the first time it is called. This would let you
> > implement lazy lists, and get the performance bounds of the Okasaki
> > data structures. E.g. queues with worst-case (not amortized) O(1)
> > behavior.
> That wouldn't work with funs that have side effects, such as I/O.
> Maybe the compiler/VM would be able to recognize a fun that has side
> effects and avoid this optimization...
> Or maybe I'm missing something?
> erlang-questions mailing list
More information about the erlang-questions