3 ms·
I kind of wish C# would slowdown releases in some areas. I have not been a huge fan of some of the changes in the past year. I love the performance changes and
by hirvi74 11d ago
I kind of wish C# would slowdown releases in some areas. I have not been a huge fan of some of the changes in the past year. I love the performance changes and bits of functionality here and there, but the syntax-sugar is getting annoying.
- kittoes 11d agoInteresting take, how is optional functionality annoying? Isn't the fact that it's just sugar a huge benefit? Us old timers can simply stick to what we're familiar with.
- pjc50 11d agoI don't get this either. You can even lock the language level if you really don't want it, or you can just ignore it.
- fourseventy 11d agoBecause unless you are the only person maintaining your codebase other people in your organization will start using the cool new syntax sugar and optional functionality. So you will be forced to deal with it as it starts showing up in your codebase.
- samus 10d agoI'm sure that there is a tool like Checkstyle that can be used to ban features.
- hirvi74 11d ago(GP here) > Isn't the fact that it's just sugar a huge benefit? My main gripe is that I cannot remember what is allowed and not allowed between multiple versions of the same language. On a daily basis I hop between apps versioned in .NET Framework 4.8 all the way to .NET 10. I have to constant remember, are nullable types allowed here? What about 'new(); vs. new Object();', new collection syntax, new switch syntax, new extensions syntax, etc.. Plus, I just find it obnoxious that the same thing can be written so many different ways. I can think of 7 ways to assign a new empty List<T>. List<T> foo = new List<T>(); var foo = new List<T>(); List<T> foo = new(); List<T> foo = new List<T> { }; var foo = new List<T> { }; List<T> foo = []; var foo = (List<T>)[]; There are probably more that I am forgetting. What irks me most is Java is older than C#, and from what I can remember, it is not nearly this ridiculous in terms of syntactical sugar. So, what is the true benefit behind all this sugar? It hardly saves any keystrokes in the age of autocomplete in IDEs. I am inclined to believe most of the sugar is an attempt to make the language appeal to a newer generations of programmers. But I would argue features are more attractive than syntactical sugar. I believe Rust is truly impressive language. In my opinion, its syntax is uglier than sin, but that does not seem to deter many from using Rust.
- troupo 11d agoSome of those ways come from just plain object initialisers. Which are amazing and sorely needed in Java. That's why you get `new List<T> { };` Because it could be `new ComplexObject { <fileds and properties> }`. Same for `new`. Some come from type inference which Java also has. That's why you can have `List<T> foo = new List<T>();` and `var foo = new List<T>();` It's not really "7 ways to assign a new empty List<T>". It's "7 ways to create an object", and Java several of them, too.
- samus 10d ago> Some of those ways come from just plain object initialisers. Which are amazing and sorely needed in Java. They really aren't, and they are IMHO an antipattern since they break encapsulation. One might argue that encapsulation doesn't matter with mere data classes, but Java will cater to that use case by introducing withers.
- troupo 10d ago> They really aren't, and they are IMHO an antipattern since they break encapsulation. They don't. Java had to come up with the extremely verbose builder pattern for the exact same thing. And withers are basically the same tedious manual builder pattern, just with a different name. For withers C# just has the with keyword: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/with-expression https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...
- ygra 11d agoYou don't really have to use the latest C# version, though. Install the latest .NET and you get the performance improvements without usually having to change anything about your code.
- whizzter 11d agoPeople complain, but most of the actually used changes are in things that continually used where I find painpoints. Not 100% on board with the collection expression changes (I found fluent Linq chains usually more readable), but they're improving painpoints so I think it'll work out in the end hopefully.
- tancop 11d agoMost new syntax features make code more readable. For those that don't there are company style guides and `AGENTS.md`. The C++ philosophy comes down to "if it works ship it" and I don't think you're expected to use every single new feature.