[Issue 9724] Range predicates are not restrictive enough to justify assumptions made in Phobos code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 15 06:21:40 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9724



--- Comment #3 from monarchdodra at gmail.com 2013-03-15 06:21:39 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > Predicates? Did you mean "traits" or "restrictions" ?
> 
> They are predicates, mappings from types to bool.

Ah OK, I was confused, given the term is often used in algorithms for a
specific context.

> > Either way, I don't think that's the problem, as TrollFace (and immutable
> > TrollFace) are both 100% legit Ranges.
> > 
> > The problem lies in the implementation that attempts to be immutable aware, and
> > tries to cast away immutability via copying. Which it can't.
> > 
> > The solution is to simply strip range of all its unqual code.
> 
> I think TrollierFace will still break many of them.

Hum. My testing shows that once you "fix" the ranges, then the code mostly just
fails at the call side, since all these functions take by value. But had they
taken by ref, then the error would be inside the implementation, so good catch.

I think there is a bug in isForwardRange. It should test at the very least that
the result of save can be used to instantiate a new Range (eg: R r2 = r.save;).
If we don't have this, then being able to call save is mostly pretty
irrelevant...

...either that, or too restrictive to be useful anyways.

I had a fix prepared for another un-related bug in isForwardRange, so I'll also
do this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list