In F# the syntax sugar hides the CLR implementation, why not in C# 4.0?
In C#, a 7-tuple is a tuple that contains seven elements and it is also known as Septuple.
The word "tuple" in C# refers to a data structure which may consist of multiple parts. This data structure may or may not be a dataset with multiple values. Tuples were first introduced with . NET framework 4.0, and they allow a maximum of 8 elements.
A tuple is a data structure that has a specific number and sequence of values. The Tuple<T1,T2,T3> class represents a 3-tuple, or triple, which is a tuple that has three components. You can instantiate a Tuple<T1,T2,T3> object by calling either the Tuple<T1,T2,T3> constructor or the static Tuple.
In C#, a 4-tuple is a tuple that contains four elements and it is also known as quadruple. You can create a 4-tuple using two different ways: Using Tuple<T1,T2,T3,T4>(T1, T2, T3, T4) Constructor.
We considered adding a syntactic sugar for tuples. I think everyone agrees that it's a nice feature, but it simply didn't fit into the budget.
It seems unlikely that someone using the features of the C# language to their appropriate level would require a Tuple containing more than 7 elements, especially given the existing and established techniques for problem solving and C#'s primarily OO approach to solution development.
F#, on the other hand, is a language designed to be primarily functional. As such, it does things in a primarily functional way and the language features are focused toward that primary concept. Resultantly, it made a lot more sense to spend the resources required to supply the language feature you're requesting in F# than it did in C#.
Remember that all new language features start with 100 points against them. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With