protocol for using InputRanges

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Wed Mar 26 11:04:43 PDT 2014


On Wednesday, 26 March 2014 at 17:36:08 UTC, Andrei Alexandrescu 
wrote:
> I think requiring users to call empty before front on input 
> ranges is a concession we should make.

Then the name should change to "ready". It makes sense to require 
the user to check that the range is "ready", but not to check 
that it is "not empty". This will also make more sense for async 
implementations that will block if "not ready".

IMO the whole interface needs rethinking if you want to 
gracefully support async data streams where you need to 
distinguish between: "ready" vs "empty", "front" vs 
"firstavailable". Both quick-sort, merge-sort, filter and map 
work well with async data streams.


More information about the Digitalmars-d mailing list