3 ms·
New Features in C# 7.0
- jitl 10y agoCan we get a [video] tag?
- wmccullough 10y agoAlso, 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%2f%2fsec.ch9.ms%2fsessions%2f69613110-c334-4f25-bb36-08e5a93456b5%2f105WhatsNewVBandCSharp.pptx https://view.officeapps.live.com/op/view.aspx?src=https%3a%2...
- gerry_shaw 10y agoThanks, that was a great slide deck.
- wmccullough 10y agoI 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.
- dgritsko 10y agoAgree, 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...
- platz 10y agoThat 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
- sharpercoder 10y agoI'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.
- platz 10y agoThe sweet spot for tuples are single-use cases local to a function, not global tuples flying around
- danthejam 10y agoLocal 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.
- platz 10y agoThe only benefit over anonymos fns i see is avoiding allocation. Maybe there are attributes you cant easily put on anon fns as well
- platz 10y agoThey 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
- lukasm 10y agoMutable 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.
- Locke1689 10y agoTuples are value types, so every new reference to a tuple is a copy. This avoids a lot of the situations you would normally get.
- sctb 10y agoPrevious discussions: https://news.ycombinator.com/item?id=12356259 https://news.ycombinator.com/item?id=12356259, https://news.ycombinator.com/item?id=12971841 https://news.ycombinator.com/item?id=12971841