On Monday, 25 June 2012 at 17:26:23 UTC, Mehrdad wrote:
I feel like isInfinite is useless for typical cases... the only "infinite" (perhaps I should call it "unbounded" instead?) range I've ever realistically come across is a stream, like console input or a network stream.

Of course, isInfinite doesn't make any sense for any type of wrapper around console input -- is it true or false? You can't tell, because it depends on whether the input is redirected. If the console input was redirected, then it would be finite, with a certain length (the length of the file).
If not, then it would be infinite (er, unbounded).

So IMHO, we should deprecate isInfinite entirely, and instead rely on length being size_t.max.

Not only would it make more sense, but it would make it possible to create a random-access wrapper around an input range (like console input), which lazily fetches its data.
Then you can work with console input like a regular string!

This also prompts another issue:
The length of a range should be a long, not size_t.

Otherwise there's no way we could possibly replace streams with ranges. 32-bit systems have LOTS of common streams that are over 2^32 bytes (e.g. DVD images, partition images, large movies, etc.).

Reply via email to