[Issue 4850] New: std.conv.to isn't pure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 10 12:51:30 PDT 2010


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

           Summary: std.conv.to isn't pure
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-09-10 12:51:04 PDT ---
This is a low-priority request, maybe a long-term one.

With dmd 2.048 this program shows that to!() is not pure:
test.d(3): Error: pure function 'main' cannot call impure function 'to'


import std.conv: to;
pure void main() {
    to!int("1");
}


But in theory the to!() doesn't need to change its inputs, and its output is
deterministic and fully determined by the input value. So eventually to!() may
become pure, so you may use it inside pure functions too.

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