https://www.youtube.com/watch?v=mWR9Q_pTagw
Then enable it to be integrated with C# code:
https://www.allaboutcircuits.com/technical-articles/csharp-w...
Voila! A C# light!
It interacts in surprisingly complicated ways with a surprising number of other parts of the language. It causes problems with prospective new features. IIRC there have been a number of bugs in the spec and in the compiler wrt overloading. Given the overall high level of expertise of people working on the spec I would say it’s a bit of a minefield, compared to the rest of the language.
Edit: Found a Q&A by John Skeet, https://youtu.be/8UvTdobOiJk?t=1292
“Overload resolution is the nexus that every feature ends up contributing to. […] All of these things make overload resolution and type interface really really really complex and it’s always a bit of the C# specification that I found hardest to understand […] and it turns out so did the spec designers, because they got it wrong, and we’ve been trying to fix it.”
JavaScript has the same problem but is much worse.
It seems we don't know when to stop with this stuff.
https://www.microsoft.com/en-us/research/wp-content/uploads/...
(Note to the pedants: Although C-flat and B are enharmonically equivalent they are not the same.)
Things that I think feel awkward are the tuples handling, switch case pattern matching. As a go developer, when I see the Func, Action, Expression, and Predicate objects... oof I shudder. When you layer function overloading on top of those, you can get in a mess.
Obviously it's an unpopular opinion, but I would like to see what c# would look like if it was designed from scratch again.
Choosing just on the language I wouldn't choose C# but when working in an ecosystem built around C# (like Unity for me currently) I appreciate many of the features as making things a bit nicer.
When they would design it today from scratch, I think they would look at JavaScript.
void foo()
{
object pi = 3.14d;
switch (pi)
{
case int i:
Console.WriteLine("pi is an int of value " + i);
break;
case float f:
Console.WriteLine("pi is a float of value " + f);
break;
case double d:
Console.WriteLine("pi is a double of value " + d);
break;
default:
Console.WriteLine("pi is of an unknown type.");
break;
}
}
Elegance is of course in the eye of the beholder, so what would you propose as an improvement to something like this? void foo()
{
object pi = 3.14d;
Console.WriteLine(pi switch
{
int i => "pi is an int of value " + i,
float f => "pi is a float of value " + f,
double d => "pi is a double of value " + d,
_ => "pi is of an unknown type.";
});
}
Check-out https://neelbhatt.com/2018/05/19/c-8-0-expected-features-par... Cheers!Every programming language that advertises itself as simple, it isn't any longer simple if it actually is adopted by the market at large.
Go is the newest example, already with a few quirks, needed to revamp their dependecy story, the team finally cave in to look into better solutions for error handling and generic programming.
Here's a fun game for people who use Go: why does this error?