[<<][compsci][>>][..]
Sat Jul 15 10:58:06 EDT 2017

Intersection between igen.erl and source.erl

Problem: can't turn a list into an igen without creating a separate
process.  But it is possible to constrain the interface such that:

- reader will only "pop once".
- the "next" thunk is explicitly updated


How to guarantee single-use of the the "next" thunk?  This doesn't
seem possible without storing state somehwere -- same problem as
implementing proper lazy evaluation.

So it's not possible to constrain this at run time.  Can it be
expressed in types?

EDIT: no generic solution, so solve it in the implementation.  I.e. if
a function uses the input souce in a "pop once" fashion, it can
manually convert an igen using igen:to_source_leaky/1 and guarantee
proper usage such as performing igen:close/1.






[Reply][About]
[<<][compsci][>>][..]