Transient ranges
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 14 10:56:43 PDT 2016
On Monday, 13 June 2016 at 13:59:06 UTC, Steven Schveighoffer
wrote:
> So what it seems like you want is somerange.map(...).front to
> evaluate the lambda only once, without caching. This doesn't
> fit into the definition of ranges, which require the ability to
> access the same front more than once.
>
> What you really want is a new kind of construct. It's not a
> range.
I think you are completely right here, though it is not very
comforting :) Indeed, looking now through all uses of ranges in
my code, it has always been same specific subset of their
functionality - input range based pipeline. Chunk input, build up
filters/transformations, write output. Never random access or
even `.save`, and each original input chunk is supposed to be
processed only once.
Every of my complaints is simply a natural outcome of this usage
pattern - I'd really prefer to have something more stupid but
also more fool-proof.
More information about the Digitalmars-d
mailing list