News for hackers. Stuff that matters.
Re:New Features in C# 7.0 by jsmeaton on Thursday March 09, 2017 @10:35PM (#13836151)
These all look great, especially tuple literals. I wonder why they chose to make tuples mutable though. Can anyone answer that question?
Re:New Features in C# 7.0 by zastrowm on Friday March 10, 2017 @11:40AM (#13839861)
From https://github.com/dotnet/roslyn/issues/347 (Details > Mutability):

  > Should tuples be mutable or immutable? The nice thing about them being 
  > structs is that the user can choose. If a reference to the tuple is 
  > readonly then the tuple is readonly. 
  
  > Now a local variable cannot be readonly, unless we adopt #115 (which is 
  > likely), but that isn't too big of a deal, because locals are only used 
  > locally, and so it is easier to stick to an immutable discipline if you 
  > so choose. 
  
  > If tuples are used as fields, then those fields can be readonly if 
  > desired.
Re:New Features in C# 7.0 by louthy on Friday March 10, 2017 @12:21AM (#13836576)
They're not. The type ValueTuple is a value-type.
Re:New Features in C# 7.0 by Pxtl on Friday March 10, 2017 @12:34AM (#13836625)
While value-types are recommended to be immutable, it is not mandatory.
Re:New Features in C# 7.0 by jsmeaton on Friday March 10, 2017 @02:49AM (#13837036)
You're right, I missed that bit. How does that gel with the comment that they contain mutable fields?

> Tuples are value types, and their elements are simply public, mutable fields