Arguably one of the biggest downsides of c++ is that it has tons of features without there being a syntactic sugar for using them, which in turn makes them less attractive
Arguably one of the biggest downsides of c++ is that it has tons of features without there being a syntactic sugar for using them, which in turn makes them less attractive
There is so much different syntactic sugar to do the same thing that it’s becoming very difficult to onboard new devs to any slightly complex application worked on by multiple devs because invariably the codebase will consist of 3-4 syntaxes doing the same thing which can get really hard to grok.
In an ideal world C# would have gotten rid of a lot of the ceremonial code it had but unfortunately backwards compatibility means that’s not likely to happen.
I wish C# declared a preferred singular syntax for every scenario and provided IDE support to warn when that preferred syntax wasn’t being used.
No one is sure what problem it is trying to solve anymore.
Also the amount of people I see blowing their toes off by not understanding stuff like LINQ and when stuff is executed and materialised into memory is insane. That and entirely not understanding async and any weird side effects like things happening on other threads and losing context and all sorts. Urgh.
Im sure C# version 22 or whatever it's on now will allow you to write in plain English at compile time and it'll use CoPilot to compile this to C# which doesn't work.
This is exactly the same story as c++. You’d think we’d learn from history.
Too many smart language people trying to justify their salary.
Have an example of overlapping syntax?
int Foo => 4;
private int Foo { get => 4; }
private int Foo { get { return 4; } }
https://sharplab.io/#v2:CYLg1APgAgTAjAWAFBQMwAJboMLoN7LpHoCW...
Yes, so you are right.
I don't get why in IL, the expression bodied member is different, though. Still, makes sense if you have learned C# starting from the most verbose form (3) then (2) was introduced, then (1).
E.g. you could add
private int Foo { get; } = 4;
To the above example given that the behaviour is identical, although the compiled output should be different so I didn't to avoid any nit pickers.
Built in ones are here https://learn.microsoft.com/en-us/visualstudio/ide/visual-cs...
If you want to apply a coding style, there are lots of free tools for that even, or you could investigate something like ReSharper from jetbrains.
https://learn.microsoft.com/en-us/visualstudio/ide/code-styl...