digitalmars.D.bugs - [Issue 1288] New: Variables with type tuple as type should be able to act as lvalues
- d-bugmail puremagic.com (27/27) Jun 23 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1288
- d-bugmail puremagic.com (20/20) Jun 26 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1288
- d-bugmail puremagic.com (15/30) Jun 27 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1288
- d-bugmail puremagic.com (9/9) Jan 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=1288
http://d.puremagic.com/issues/show_bug.cgi?id=1288
Summary: Variables with type tuple as type should be able to act
as lvalues
Product: D
Version: 1.016
Platform: Other
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: onlystupidspamhere yahoo.se
This works
template Tuple(T...) { alias T Tuple; }
void main() {
Tuple!(int,int) foo;
but
foo = Tuple!(1,1);
}
causes
Error: foo is not an lvalue
Error: forward reference to type (int, int)
Error: cannot implicitly convert expression (tuple(1,1)) of type (int, int) to
(int, int)
Error: cannot cast int to (int, int)
--
Jun 23 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1288
davidl 126.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
IMO, your code should be as following:
import std.bind;
void main() {
Tuple!(int,int) foo;
foo = Tuple!(int,int)(1,1);
}
And the compiler emits the correct message IMO
If this is something about first class tuple, it's already on bug 1293
But I don't think D is gonna integrate such obscure builtin tuple.
And even first class tuple gets integrated , I still consider your code
shouldn't
work
--
Jun 26 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1288
onlystupidspamhere yahoo.se changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
IMO, your code should be as following:
import std.bind;
void main() {
Tuple!(int,int) foo;
foo = Tuple!(int,int)(1,1);
}
And the compiler emits the correct message IMO
std.bind uses parametrized structs as tuples, that's why the assignment works.
It's simply a workaround. IIRC you can see from the executable that those
assignments generate unnecessary runtime code.
If this is something about first class tuple, it's already on bug 1293
For most parts, yes. I left this open because it's a easier to implement and I
could have use for it without having e.g. tuple literals. But I'll leave this
closed now.
But I don't think D is gonna integrate such obscure builtin tuple.
And even first class tuple gets integrated , I still consider your code
shouldn't work
I would leave that for Walter to decide.
--
Jun 27 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1288
Andrei Alexandrescu <andrei erdani.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|CLOSED |RESOLVED
CC| |andrei erdani.com
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 26 2013









d-bugmail puremagic.com 