Thread overview
[Issue 9011] New: One more strongly pure case
Nov 13, 2012
Kenji Hara
November 12, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9011

           Summary: One more strongly pure case
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2012-11-12 15:56:39 PST ---
Maybe Hara has already a patch for this, but I don't remember its location.

I think it's good to refine the D purity to allow this code:


int[] foo1(int x) pure {
    return null;
}
ubyte[] foo2(string s) pure {
    return null;
}
void main() {
    immutable a1 = foo1(10); // OK
    immutable a2 = foo2("hello"); // currently error
}



Currently in DMD 2.061alpha it gives:

test.d(9): Error: cannot implicitly convert expression (foo2("hello")) of type
ubyte[] to immutable(ubyte[])


This enhancement means that foo2 becomes strongly pure.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 13, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9011


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |http://d.puremagic.com/issu
                   |                            |es/show_bug.cgi?id=8408


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-11-12 20:12:05 PST ---
Related: issue 8408

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 13, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9011


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #2 from bearophile_hugs@eml.cc 2012-11-12 20:23:55 PST ---
*** This issue has been marked as a duplicate of issue 8408 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------