News for hackers. Stuff that matters.
Re:New Features in C# 7.0 by wmccullough on Friday November 18, 2016 @01:04PM (#12988679)
I for one am incredibly excited for both Pattern Matching and proper Tuples.

I have code bases that are about to become significantly shorter because of both. I do need to sit down and perform an analysis to understand the performance implications of this, thought I suspect there aren't many.

I'm not sure what to make of local functions. I've read and re-read about them but I still don't see the utility over a private function, unless they were intended to alleviate the performance issues that come with using a local Func<> inside of a method.

Re:New Features in C# 7.0 by sharpercoder on Friday November 18, 2016 @01:18PM (#12988826)
I'm torn about these features. On one hand I can see the usefullnes, but on the other hand I also expect them to be used in bad ways.

Pattern matching for example on types may indicate an OO design problem. Tuples may indicate an expression problem; often times a properly named class expresses intent much better.

As with any tool it is possible to misuse it, but pattern matching and tuples feel to me somehow as an especially fit tool to misuse.

Re:New Features in C# 7.0 by platz on Friday November 18, 2016 @01:23PM (#12988886)
The sweet spot for tuples are single-use cases local to a function, not global tuples flying around
Re:New Features in C# 7.0 by dgritsko on Friday November 18, 2016 @01:10PM (#12988745)
Agree, both of those features are very exciting and I'm looking forward to using them. The biggest feature I'm still missing from C# is a non-nullable reference type. I know there are various Nuget packages that add "Maybe" or "Optional" types, but they are no substitute for actually being a part of the language. Maybe one day...
Re:New Features in C# 7.0 by platz on Friday November 18, 2016 @01:26PM (#12988914)
That ship has already sailed.. anything they could do in the language now would just be like a user defined Optional. Youd still have to marshall the nullable refs into your pristine code
Re:New Features in C# 7.0 by platz on Friday November 18, 2016 @01:21PM (#12988859)
They should've called it Destructuring rather than Pattern Matching. Because when they want to add real pattern matching later theyll have to use a new keyword or confuse the concepts
Re:New Features in C# 7.0 by danthejam on Friday November 18, 2016 @01:19PM (#12988837)
Local functions look like they follow Python's reasons for avoiding anonymous functions in favor of nested functions.

It's a nice touch you can define the function at the end, looks clearer.

Re:New Features in C# 7.0 by platz on Friday November 18, 2016 @01:25PM (#12988895)
The only benefit over anonymos fns i see is avoiding allocation. Maybe there are attributes you cant easily put on anon fns as well
Re:New Features in C# 7.0 by lukasm on Friday November 18, 2016 @01:09PM (#12988731)
Mutable tuples look like a really weird design choice. The most important reason I used tuples in python is the immutable semantic they have - this won't change.
Re:New Features in C# 7.0 by Locke1689 on Friday November 18, 2016 @01:25PM (#12988899)
Tuples are value types, so every new reference to a tuple is a copy. This avoids a lot of the situations you would normally get.
Re:New Features in C# 7.0 by sctb on Friday November 18, 2016 @01:23PM (#12988882)
Re:New Features in C# 7.0 by jitl on Friday November 18, 2016 @12:54PM (#12988604)
Can we get a [video] tag?
Re:New Features in C# 7.0 by wmccullough on Friday November 18, 2016 @12:56PM (#12988618)
Also, here is the raw slide deck in case anyone wants to skip the video:

https://view.officeapps.live.com/op/view.aspx?src=https%3a%2...

Re:New Features in C# 7.0 by gerry_shaw on Friday November 18, 2016 @01:17PM (#12988813)
Thanks, that was a great slide deck.