News for hackers. Stuff that matters.
Re:Is .NET just miles ahead or am I delusional? by Xeamek on Saturday April 13, 2024 @07:01AM (#40022165)
But syntactic sugar is important though.

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

Re:Is .NET just miles ahead or am I delusional? by addicted on Saturday April 13, 2024 @07:11AM (#40022240)
There’s having syntactic sugar and there’s whatever the F C# is trying to do.

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.

Re:Is .NET just miles ahead or am I delusional? by dagaci on Saturday April 13, 2024 @07:44AM (#40022444)
Visual Studio has build in snippets for boilerplate stuff, so you can type class[tab], ctor[tab], prop[tab] to inject a class contrutor or property into you code. Other IDEs will have similar.

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...

Re:Is .NET just miles ahead or am I delusional? by cjk2 on Saturday April 13, 2024 @07:13AM (#40022253)
I said this elsewhere in the thread, but C# reminds me of The Homer now. https://simpsonswiki.com/wiki/The_Homer

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.

Re:Is .NET just miles ahead or am I delusional? by christophilus on Saturday April 13, 2024 @08:00AM (#40022561)
LINQ is maybe the only thing I miss from my .NET days. But this was the biggest problem with it. It was easy for newcomers to accidentally introduce horrendous performance by failing to understand how LINQ would translate to the underlying store.
Re:Is .NET just miles ahead or am I delusional? by cjk2 on Saturday April 13, 2024 @08:02AM (#40022574)
Yeah we broke everything one day with a bad merge conflict resolution. The ToList() ended up before the Where() and after Where()!. Tests passed, integration tests worked. Until we had 2000 front end cluster threads all trying to pull a 2 billion row table.
Re:Is .NET just miles ahead or am I delusional? by bradleyjg on Saturday April 13, 2024 @07:27AM (#40022357)
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.*

This is exactly the same story as c++. You’d think we’d learn from history.

Re:Is .NET just miles ahead or am I delusional? by PedroBatista on Saturday April 13, 2024 @09:20AM (#40022967)
If that gives you any comfort “new” Java is starting to go the same way.

Too many smart language people trying to justify their salary.

Re:Is .NET just miles ahead or am I delusional? by thefz on Saturday April 13, 2024 @07:34AM (#40022393)
> There is so much different syntactic sugar to do the same thing

Have an example of overlapping syntax?

Re:Is .NET just miles ahead or am I delusional? by ludston on Saturday April 13, 2024 @10:47AM (#40023484)
All the same:

int Foo => 4;

private int Foo { get => 4; }

private int Foo { get { return 4; } }

Re:Is .NET just miles ahead or am I delusional? by thefz on Saturday April 13, 2024 @12:02PM (#40024007)
Do these all compile to the exact same thing?

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).

Re:Is .NET just miles ahead or am I delusional? by ludston on Saturday April 13, 2024 @07:21PM (#40027124)
I could probably give 20 different examples of this too. Not all of them would have identical compiler output, but the behaviour would be.

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.

Re:Is .NET just miles ahead or am I delusional? by masklinn on Saturday April 13, 2024 @07:05AM (#40022193)
C++ has tons of syntactic sugar, the problem is that it's largely syntactic diabetes leaving you confused and unsure about what's happening. The recent article about C++ initialisation was a good reminder.