Get rid of isInfinite()?
Mehrdad
wfunction at hotmail.com
Mon Jun 25 10:26:22 PDT 2012
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!
More information about the Digitalmars-d
mailing list