digitalmars.D.bugs - [Issue 7273] New: Tuples conversion assign
- d-bugmail puremagic.com (37/37) Jan 11 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7273
- d-bugmail puremagic.com (11/11) Jan 12 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7273
- d-bugmail puremagic.com (14/22) Jan 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=7273
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 puremagic.com
ReportedBy: bearophile_hugs eml.cc
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: -------
Jan 11 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7273
Note this currently works:
import std.typecons: Tuple, tuple;
void main() {
immutable int x = 1;
Tuple!(int) y = tuple(1);
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 12 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7273
Andrej Mitrovic <andrej.mitrovich gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich gmail.com
17:58:38 PST ---
Note this currently works:
import std.typecons: Tuple, tuple;
void main() {
immutable int x = 1;
Tuple!(int) y = tuple(1);
}
I think you meant to write:
Tuple!(int) y = tuple(x);
Anyway this seems like more of a compiler issue than a library issue, because I
don't think we can fix this in the library.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 21 2013









d-bugmail puremagic.com 