Feels kinda crazy to see tuples and pattern matching "just arrive" when other languages have had them for years.
That's a huge line to cross though! Once you give it a name then you generally have to give it a home somewhere.
No language has every feature. C# is making enormous strides ahead of many of its counterparts.
https://msdn.microsoft.com/en-us/library/system.tuple(v=vs.1...
Namely, heap allocation and the inability to name tuple members.
Type inference FTW.
using Complex = System.Tuple<double, double>;
Edit: Clarity
using Complex = System.Tuple<double, double>;
is less verbose than public class Complex
{
public double i { get; set; }
public double j { get; set; }
} public class Complex {
private readonly double _i;
private readonly double _j;
public double I {get {return _i;}}
public double J {get{return _j;}}
public Complex(double i, double j){
_i = i;
_j = j;
}
}
But System.Tuple is also IComparable, IStructuralComparable, IStructuralEquatable. I haven't had enough coffee yet to add all the boilerplate for that to the above, which only reinforces the point about verbosity. public class Complex {
public double I { get; }
public double J { get; }
public Complex(double i, double j) {
I = i;
J = j;
}
} public class Complex {
public double I { get; private set; }
public double J { get; private set; }
public Complex(double i, double j) {
I = i;
J = j;
}
}