More range woes: std.array.save is invalid
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Dec 20 11:07:06 PST 2012
On Thu, Dec 20, 2012 at 01:47:16PM -0500, Andrei Alexandrescu wrote:
> On 12/20/12 12:48 PM, Jonathan M Davis wrote:
> >On Thursday, December 20, 2012 08:03:04 H. S. Teoh wrote:
> >>Because the definition of .save only requires that the state of the
> >>outer range is saved. Nothing is guaranteed about the state of the
> >>inner ranges.
> >
> >That just means that that anything involving ranges of ranges needs
> >to be written with the understanding that saving the outer range
> >doesn't save the inner ones. So, we may have bugs with regards to
> >this (similar to how we have bugs related to not calling save when we
> >should), but there's still no problem with save itself - only with
> >how it's used.
Yes, I just submitted a pull request for joiner (the no-separator
variant), and am working on another pull for the with-separator variant
of joiner.
We will also need to review all algorithms/wrapper ranges that take a
range-of-range parameter for correctness.
> >So much of this would have been easier though if reference type
> >ranges had been disallowed. Too late now though. We'll just have to
> >fix such bugs as we find them and strengthen the unit tests so that
> >they get caught like they should be.
>
> I think this whole issue is akin to the "transitory" discussion of a
> while ago.
[...]
Which has still not be resolved. :-/
Can we at the very least agree that any Phobos algorithm that *can* be
made to work with transient ranges (without incurring performance or
other problems), should? I can work through the list I posted some time
ago and submit pulls for them.
It would be better than doing nothing at all, though this is IMO still
not fully satisfactory. If nothing else, I think we should update the
documentation to warn users of potential pitfalls with using transient
ranges, and indicate clearly which algorithms have been vetted for safe
operation with transient ranges.
T
--
Why are you blatanly misspelling "blatant"? -- Branden Robinson
More information about the Digitalmars-d
mailing list