News for hackers. Stuff that matters.
Re:New Features in C# 7.0 by e28eta on Thursday March 09, 2017 @06:33PM (#13834893)
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?

Re:New Features in C# 7.0 by ellism on Thursday March 09, 2017 @09:06PM (#13835748)
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.

Re:New Features in C# 7.0 by icecube on Thursday March 09, 2017 @06:45PM (#13834973)
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.
Re:New Features in C# 7.0 by e28eta on Thursday March 09, 2017 @07:29PM (#13835242)
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.
Re:New Features in C# 7.0 by tintoy on Thursday March 09, 2017 @06:41PM (#13834947)
Perhaps it's because they're item numbers, not indexes? As far as I can tell, C# uses 0-based indexing because most similar languages use 0-based indexing.