News for hackers. Stuff that matters.
Re:C# 10 new feature CallerArgumentExpression by spaetzleesser on Monday November 15, 2021 @06:57PM (#29234664)
I feel it's getting really hard to keep up. They are adding a lot of piecemeal improvements but it seems there is no coherent strategy,
Re:C# 10 new feature CallerArgumentExpression by naasking on Monday November 15, 2021 @09:11PM (#29235859)
I don't think that's true by and large. C# started purely object-oriented, and it progressively started extending it's usability into functional programming domains (pattern matching, null coalescing, tuples, lambdas), lower-level code (return ref structs, memory spans), and relational programming (LINQ).

So basically, C# is incorporating diverse programming idioms with different strengths from OOP so you can choose the right one for the problem at hand.

Re:C# 10 new feature CallerArgumentExpression by oaiey on Tuesday November 16, 2021 @04:13AM (#29238508)
In the past they released every three years. Now they release every year. So it is a piecemeal. But there are very strong themes active right now

- simplification for newbies (global usings, top level statements)

- better memory management for performance (ref, readonly, in, value task, custom task providers, ..)

- bring functional structures loved by many (tuples, records, pattern matching, generic math)

- code generation for aot and simplicity (code generators)

- and always productivity (many small things)

In the past we had themes about asynchronity, linq, generics (think also co/contravariance), etc.

I do once a year a training for my fellow engineers. The churn is not too big if you keep up to date once a year and start using it a bit.

Re:C# 10 new feature CallerArgumentExpression by linknoid on Monday November 15, 2021 @09:40PM (#29236079)
A lot of the improvements are just logically extending the language to remove arbitrary restrictions. That's what most of C# 10 and 9 appear to be. So most of the features you wouldn't go out of your way to use, but instead stuff that used to be impossible is now possible. I can't say that I've ever wanted a generic attribute, or a constant interpolated string, but if I did want them, I'd be surprised when they didn't work. C# 8 was the last major new language features.
Re:C# 10 new feature CallerArgumentExpression by spaetzleesser on Monday November 15, 2021 @11:10PM (#29236708)
But a lot of them seem totally arbitrary and inelegant. CallerArgumentExpression requires a lot of attributes. CallerMemberName gives you the name of the caller but not the class name. This is hard to explain. It just seems random.
Re:C# 10 new feature CallerArgumentExpression by guhidalg on Tuesday November 16, 2021 @12:12AM (#29237105)
It's not hard to explain, it's a logical and small extension of other compiler-driven attributes. Just because you don't like it doesn't mean it's a bad change to the language.