[Issue 13608] New: std.range range interfaces hide @safe-ness

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Oct 12 23:32:08 PDT 2014


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 at puremagic.com
          Reporter: braddr at 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'

--


More information about the Digitalmars-d-bugs mailing list