www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11387] New: Tuple of dynamic array literal can't be immutable

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

           Summary: Tuple of dynamic array literal can't be immutable
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            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 2013-10-30 12:35:33 PDT ---
A low-priority enhancement suggestion:


import std.typecons: tuple;
void main() {
    immutable t = tuple([1, 2]);
}


dmd 2.064beta3 gives:

test.d(3): Error: cannot implicitly convert expression (tuple([1, 2])) of type
Tuple!(int[]) to immutable(Tuple!(int[]))

I presume built-in tuples could do this too.

To do this with Phobos-defined tuples, there should be a way to know that the
input dynamic array is pure. I don't know if and how this can be done.

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