C# 8: Switch expressions
alexatnet.com
C# 8: Switch expressions
1–10 of 124 posts
Re: C# 8: Switch expressions
#2Or actually, to bait a few more hn clicks (and provide a fuller description): "Pattern matching in C# 8 with switch expressions"
Re: C# 8: Switch expressions
#3This might be better titled "C# 8: switch expressions" (edit: it was previously "statement", as the author's post is titled). Or actually, to bait a few more hn clicks (and provide a fuller description): "Pattern matching in C# 8 with switch expressions"
The new syntax is not intuitive, not more readable, just a bit more terse.
Re: C# 8: Switch expressions
#4This might be better titled "C# 8: switch expressions" (edit: it was previously "statement", as the author's post is titled). Or actually, to bait a few more hn clicks (and provide a fuller description): "Pattern matching in C# 8 with switch expressions"
Edit: ye, iOS, ye!
Re: C# 8: Switch expressions
#5Re: C# 8: Switch expressions
#6This might be better titled "C# 8: switch expressions" (edit: it was previously "statement", as the author's post is titled). Or actually, to bait a few more hn clicks (and provide a fuller description): "Pattern matching in C# 8 with switch expressions"
This might be better titled "changing things for the sake of changing things and appealing to the programming language geeks". The new syntax is not intuitive, not more readable, just a bit more terse.
Re: C# 8: Switch expressions
#7 // now you kind of enforced to
// handle all values, otherwise
// it will not compile
I fail to see how it will not compile if all values are not handled. C# switch is not traditional pattern matching, because you don't get compile time feedback.Claiming that is does is disingenuous.
Re: C# 8: Switch expressions
#8 "+" => ((Func)(() => {
Log("addition");
return a + b;
}))(),
This is incredibly ugly. Why couldn’t it be “+” => {stuff}Re: C# 8: Switch expressions
#9Re: C# 8: Switch expressions
#10This might be better titled "C# 8: switch expressions" (edit: it was previously "statement", as the author's post is titled). Or actually, to bait a few more hn clicks (and provide a fuller description): "Pattern matching in C# 8 with switch expressions"
This might be better titled "changing things for the sake of changing things and appealing to the programming language geeks". The new syntax is not intuitive, not more readable, just a bit more terse.
While I use them every day, my favorite is still “replacing” String.Format with string literals. Shorter, sure, but less intuitive particularly for people coming from another language. You can do roughly the same thing in PHP with backticks, but most people avoid them for the same reasons.
I’m not sure how I feel about the trend as a whole. As long as I can continue using the old methods as well I suppose I don’t have much room to complain, but sometimes it does feel like we’re just changing for the sake of change and that’s usually a bad indicator.