www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9011] New: One more strongly pure case

reply d-bugmail puremagic.com writes:
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



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: -------
Nov 12 2012
next sibling parent d-bugmail puremagic.com writes:
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



Related: issue 8408

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9011


bearophile_hugs eml.cc changed:

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



*** 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: -------
Nov 12 2012