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

Jacob Carlborg doob at me.com
Tue Sep 25 00:11:03 PDT 2012


On 2012-09-25 03:19, ixid wrote:
> What would a special case where the first level of tuple (with higher
> levels being tuples in tuples) didn't require parens break? This would
> be a beautiful syntax:
>
> auto a = 1, 2; // A tuple of two ints
>
> int, string fun(double, double d) {
>      return cast(int) (d[0] * d[1]), "hello";
> }
>
> auto a, b = 1, 2; // Two ints
> auto a = fun(1.0, 1.0); // Tuple of 1 and "hello".
> auto a, b = fun(1.0, 1.0); // An int and a string.
>

I like this one.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list