DIP19: Remove comma operator from D and provision better syntactic support for tuples

Michael pr at m1xa.com
Wed Sep 26 12:18:24 PDT 2012


> Also, I want to add that type declarations should be changed 
> from statements to expressions so that we could do:
> auto tup = (3, "hello");
> (int num, string s) = tup; // num == 3, s == "hello"

+1.

or

int num;
string s;
auto tup = (3, "hello");

(num, s) = tup;

or like x++ containers 
http://msdn.microsoft.com/en-us/library/aa874816.aspx

auto tup = [3, "hello"];

[num, s] = tup;

In general it's very useful.


More information about the Digitalmars-d mailing list