The current plan is to introduce tuples once we have value type, because unlike 
arrays, a value type can be stack allocated or even register allocated.

No, there's no current plan to introduce (structural) tuples.

However, records (data classes), can be thought of as "nominal tuples" -- perhaps that's what you meant?  We don't need value types to do these, though when we have value types, records can be values as well.


tuple MinMax(int min, int max);

MinMax minmax(int value1, int value2) {
   if (value1 < value2) {
     return (value1, value2);
   }
   return (value2, value1);
}

in that case we can pattern match on tuples if the target type is available

MinMax result = ...
switch(result) {
   case (res1, res2) -> res1 + res2;
   case (0, 0) -> throw ...;
}

You can do this without tuples, with feature plans that are already on the books:

    record MinMax(int min, int max);

    let MinMax(var min, var max) = minmax(..);  // unconditional pattern match
    // min and max are now in scope


Reply via email to