Must ranges support `r1 = r2;`?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Apr 16 16:15:30 UTC 2018


On Mon, Apr 16, 2018 at 03:58:34PM +0000, Jack Stouffer via Digitalmars-d wrote:
[...]
> In a perfect world, we'd have a pre-constructed test suite that people
> could plug their range (with some data in it) into, where all the
> tests make sure all Phobos assumptions hold true.
[...]

We could perhaps add a little test framework in std.internal.*
containing tests that run through a variety of different types of
ranges.  I think there's already something like this somewhere, it's
just not used as widely as it could be.

I could come up with some pretty pathological range types for
stress-testing, if you want.  (These are actual range types I've used in
my own code, I didn't set out to break Phobos, but it turned out that
Phobos makes many unstated assumptions that explode in your face when
given a more unusual instance of a range. There used to be (and may
still be) a lot of places that essentially assumes built-in array
semantics, and that blew up in ugly ways when handed something else
that's nevertheless still a valid range.)


T

-- 
Making non-nullable pointers is just plugging one hole in a cheese grater. -- Walter Bright


More information about the Digitalmars-d mailing list