On Monday, 9 May 2016 at 13:09:24 UTC, Jacob Carlborg wrote:
On 2016-05-09 14:46, John wrote:

C# 7's tuples are something different though. They don't even map to
System.Tuple. The syntax is:

   (int x, int y) GetPoint() {
     return (500, 400);

   var p = GetPoint();
   Console.WriteLine($"{p.x}, {p.y}");

Would be nice to have in D. Both with and without named fields.

I mean it is not much shorter than in D

alias Point = Tuple!(int, "x", int, "y");
Point getPoint(){
    return Point(500, 400);

What would be nice though if tuples would be implicitly convertible to named tuples, if the types matches.

Tuple!(int, "x", int, "y") getPoint(){
    return tuple(500, 400);

Reply via email to