Email list hosting service & mailing list manager

Generators and accumulators John Cowan (18 Jan 2020 21:46 UTC)
Re: Generators and accumulators Amirouche Boubekki (21 Jan 2020 10:35 UTC)
Re: Generators and accumulators Lassi Kortela (21 Jan 2020 22:45 UTC)
Re: Generators and accumulators John Cowan (21 Jan 2020 22:48 UTC)
Re: Generators and accumulators Lassi Kortela (21 Jan 2020 22:57 UTC)
Re: Generators and accumulators John Cowan (21 Jan 2020 23:02 UTC)
Re: Generators and accumulators Lassi Kortela (21 Jan 2020 23:15 UTC)

Re: Generators and accumulators Lassi Kortela 21 Jan 2020 23:15 UTC

> Generators can be wrapped around *any* source of data, at the
> expense of being unable to inline it unless you have a whole-program
> compiler.  If you are able to use an explicit lambda that gets inlined,
> so much the better, but I think the normal use case will be something
> quite different.

You're right. Cross-module analysis is much more difficult.

What about a generator that returns substrings of the source data
instead of chars, and then the parser would consume those strings as if
they were concatenated to form the complete stream? It seems like it
would be faster not to call the generator separately for each char. But
maybe these are unfounded concerns and I should run a concrete example
through a profiler.