[Issue 6365] AutoTupleDeclaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 23 09:03:27 PDT 2011


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



--- Comment #12 from bearophile_hugs at eml.cc 2011-07-23 09:03:24 PDT ---
(In reply to comment #10)
> (In reply to comment #7)
> > (auto i, j) = tuple(1.2, "a");
> > 
> > Then the syntax can be later extended to:
> > 
> > (double i, string j) = tuple(1.2, "a");
> > 
> > Anyway, we should wait for Walter to weigh in. Thanks Kenji for this work.
> 
> How about this syntax?
> auto (i, j) = tuple(1.2, "a");
> (double, string) (i, j) = tuple(1.2, "a");

It's not ugly, but I think this looks a bit better:
(double i, string j) = tuple(1.2, "a");

Also because it's closer to (more consistent with) the currently used
definition syntax:
alias Tuple!(double,"i", string,"j") T1;
auto t1 = T1(1.2, "a");

If eventually the definition syntax too will become built-in, then you will
have something like:
alias (double i, string j) T2;
auto t2 = T2(1.2, "a");

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