www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13608] New: std.range range interfaces hide safe-ness

https://issues.dlang.org/show_bug.cgi?id=13608

          Issue ID: 13608
           Summary: std.range range interfaces hide  safe-ness
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: braddr puremagic.com

The range interfaces (InputRange, OutputRange, etc) and their helper creation
functions hide the  safe-ness.  This makes it problematic to use them in what
would otherwise be  safe code.  For instance, in std/algorithm.d:

unittest
{
    // joiner() should work for non-forward ranges too.
    InputRange!string r = inputRangeObject(["abc", "def"]);
    assert (equal(joiner(r, "xyz"), "abcxyzdef"));
}

yields:
std/algorithm.d(3927): Error: safe function 'std.algorithm.__unittestL3923_114'
cannot call system function 'std.algorithm.joiner!(InputRange!string,
string).joiner'
std/algorithm.d(3927): Error: safe function 'std.algorithm.__unittestL3923_114'
cannot call system function 'std.algorithm.equal!().equal!(Result,
string).equal'

--
Oct 12 2014