[Issue 7273] New: Tuples conversion assign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 11 19:55:47 PST 2012


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

           Summary: Tuples conversion assign
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          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 2012-01-11 19:55:45 PST ---
Currently D tuples are library defined, and this probably gives some small
restrictions.

But I think well implemented built-in tuples should allow code like this,
because here we are assigning an immutable value and copying it to a mutable
one:


import std.typecons: Tuple, tuple;
Tuple!(int) foo() {
    immutable int x = 1;
    return tuple(x);
}
void main() {}



DMD 2.058head:
test.d(4): Error: cannot implicitly convert expression (tuple(1)) of type
Tuple!(immutable(int)) to Tuple!(int)


Because this code is allowed, and tuples too are values:

int foo() {
    immutable int x = 1;
    return x;
}
void main() {}

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