[erlang-questions] generators/iterators

Damien Morton dmorton@REDACTED
Mon Jun 18 02:25:35 CEST 2007


I guess calling a fun is much faster than sending messages between 
processes.

And a fun as generator can be receiving messages under the hood.
>> Umm, I just realised that a stream/generator would need to be a function 
>> that returns a function that can be called repeatedly to generate the 
>> sequence, probably terminating with a well-known sequence terminating 
>> exception.
>>
>> This would solve the problem of the generators needing to be reset 
>> during nested loops in a comprehension.
>>     
>
> Can somebody explain why it is that you wouldn't do such things with an
> Erlang process instead of something like what you describe here? The
> main issue with processes, as far as I've been able to determine by just
> thinking about it, is that they don't really get "garbage collected" so
> your code can't just forget about them like generators in other
> languages (or like funs in Erlang).
>
> --
> [ I love pre-moistened towelettes ] Mike McNally -- m5@REDACTED
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>
>   




More information about the erlang-questions mailing list