[Issue 8878] std.range is not pure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 23 14:13:43 PDT 2012


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


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #3 from bearophile_hugs at eml.cc 2012-10-23 14:13:32 PDT ---
(In reply to comment #1)

> If you have an issue with a specific function with a specific type which does
> have pure member functions and the templated function is not being inferred as
> pure, then please report it with an appropriate code sample, but it would be
> wrong to specifically provide pure versions of functions like iota or zip.

This gives:
test.d(3): Error: pure function 'main' cannot call impure function 'iota'

import std.range: iota;
void main() pure {
    iota(10);
}




This gives:
test.d(4): Error: pure function 'main' cannot call impure function 'map'
test.d(4): Error: map is not nothrow
test.d(2): Error: function D main 'main' is nothrow yet may throw

import std.algorithm: map;
void main() pure nothrow {
    int[] data = [1, 2, 3];
    auto r = map!q{a * a}(data);
}


I propose to reopen this bug report, and change its meaning and title: instead
of asking for such functions to be marked as pure, to ask them to be usable in
a pure (and sometimes nothrow) situations.

-- 
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