Is it just me, or is C# basically becoming Scala (or, insert your favorite functional language here). Don't get me wrong, this is awesome, .net on Linux, dockerized, is all good, but these moves definitely show Microsoft responding to market changes in a way they didn't used to.
Throw expressions are particularly welcome. I'd previously dealt with that issue by creating a static method that returned the expected type, but just threw an exception [1][2]<p>I'm not sure it's explicit in the blog, but it seems the deconstructor will be useful for pattern-matching using 'is'.<p>Tuples. Yay! Finally!<p>Pattern-matching-switch-statement: Not an expression. That's a bad call. We have expression based ternary, throws, method bodies, and LINQ; switches are the last and most painful omission.<p>Local functions: Fantastic for libraries like mine, which is trying to bring functional programming to the C# world, but takes a hit with the allocation of delegates for common operations [3] It should be a boon for anything LINQ based (implementations, rather than usage).<p>Return by ref and out parameters: I'd be happy if they just removed them from the language. Ugly, error magnets.<p>All in all, good progress. Hopefully they can make more progress on facilitating expression-based programming, and bring in record types for the next release. The pain of creating immutable types is truly tedious. And I'd desperately like to see partial generic parameter specifying (for when one of the generic arguments can't be inferred by the type-system, so you then end up having to specify them all).<p>[1] <a href="https://github.com/louthy/language-ext/blob/master/LanguageExt.Core/Prelude.cs#L209" rel="nofollow">https://github.com/louthy/language-ext/blob/master/LanguageE...</a><p>[2] <a href="https://github.com/louthy/language-ext/blob/master/LanguageExt.Core/Prelude.cs#L182" rel="nofollow">https://github.com/louthy/language-ext/blob/master/LanguageE...</a><p>[3] <a href="https://github.com/louthy/language-ext/blob/type-classes/LanguageExt.Core/TypeClasses/Monad/Monad.Prelude.cs#L70" rel="nofollow">https://github.com/louthy/language-ext/blob/type-classes/Lan...</a>
Pattern Matching with Is Expressions<p>Awesome! Greatly reduces "ugly" boilerplate code like this:<p><pre><code> if (control is TextBox)
{
var textBox = (TextBox)control;
textBox...
}
</code></pre>
Also, it would be great if Microsoft could make full properties in another way so that you do not have to write a backing field for it. Something like this:<p><pre><code> public string LastName
{
get;
set
{
if (value == "Batina")
RaisePropertyChanged();
}
}
</code></pre>
It would make code more cleaner.
So, lets say someone had never worked with C# or .net before and works on a mac - where would you go to get started building a small server application? I assume you would use the .net core stuff? and visual studio code? Any good tutorials for noob-to-the-ecosystem but someone that has programming experience?
Kinda surprised me Microsoft doesn't have better syntax highlighting on msdn.<p>The lack of coloration and gray background gave me a little bit of a headache.
I'm very disappointed that ref returns were not implemented as syntactic sugar for out params.<p>A bit of history: game developers have been crying for a solution to the matrix operator problem. A 4x4 matrix is 64 bytes of data. Implement the mathematical operators using C# operators and you're looking at 192 bytes copied per invocation. The workaround is the fake ref operator: void Add(ref Matrix, ref Matrix, out Matrix). The problem is that this results in code smell at the call sites. The ref return was the first compromise, allowing that method to become: ref Matrix Add(...). The ultimate solution would be to allow ref returns and ref parameters on operators, but you need ref returns first.<p>This feature misses all of that. Maybe we'll get out returns, but the argument against it would be language bloat, and even I'd agree. <i>Sigh.</i><p>/rant
It puts a smile on my beak that I am a budding (sort of) .Net and C# developer. Microsoft seems to be really jacked up and introducing some very forward thinking functionality into their ecosystem. Been playing with Azure Service Fabric. It is super impressive.
I'm interested to see what the production story is for some of these language features. I usually get left a festering minidump with a number of threads, a pile of stacks and some line numbers if I'm lucky these days. It's quite hard determining which dereference or call is the one that triggered the problem in a method body with so many things now compacted into a tight expression.<p>Granted there should be assertions to prevent these conditions occurring but not everyone on the team is perfect 100% of the time. Sometimes an edge case slides in as well and you have to heavily assert everything and push to test/production to reproduce which isn't ideal.
more improvements that allows more concise code and that looks functional in nature. Which is great, I have to do a lot in C# and really like it as a OO / with functional abilities type language.<p>But I keep wondering why F# doesn't really take off given a lot of peoples fascination with the functional world. It does functional nicely while still being able to bridge back to the OO world which allows you to easily leverage a <i></i>LARGE<i></i> amount of libraries in the .net world. It has a really good community, and F# specific frameworks for various things as well. It's like a hidden gem that people pass over as they look at functional languages with much much smaller ecosystems.
I'm a little disappointed that pattern matching doesn't simply narrow the variable, and instead requires a new variable name to hold the narrowed type. Even TypeScript narrows the variable in-place!
major part of these new features are very cool but i'm afraid they could compromise future evolution of the Language.
some implementation details scares me, maybe i'll become used to them, i only hope that these doesn't result in a boomerang for future versions.<p>Deconstruction implementation is scary, i would prefer to have a special symbol (like the desctrutor) and duples that ignores names are ok but sounds very error prone, maybe i just have to try them to understand, also order sensitive case makes my dev sense tingle...