Re:New Features in C# 7.0
by vvanders on Thursday March 09, 2017 @06:07PM
(#13834704)
Happy to see that tuples are value types too. Very nice stuff.
[ Parent
| on HN ]
As someone unfamiliar with C#, it's strange that the default tuple element names start numbering at 1 (Item1, Item2...)
Anyone know why it doesn't start with Item0?
For what it's worth, I'm the one of the folks that designed the original tuple class (the reference type, System.Tuple, that shipped before hand).
At the time, we picked one based indexing because we felt it sounded more natural when spoken allowed (mirroring saying something like: This is the first Item in the tuple).
I would expect that the design bled over into ValueTuple, which looks very similar to the reference version, except, of course, it is a value type.
It has to due with history. Traditionally, other languages (such as Scala, Haskell and ML) with statically typed tuples start at index 1 instead of 0.
Thanks! It stood out to me because Swift uses 0-based, and I suppose I either forgot or never used it in my brief exposure to Haskell & ML.