>InterceptsLocation("Program.cs", line: 3, character: 7)] That line and character worries me But since this is generated then maybe it is fine?
From the article: The new syntax is appropriate for source generators, so don't be surprised by its clunkiness
What's new in C# 12: overview
21–30 of 100 posts
Re: What's new in C# 12: overview
#22>InterceptsLocation("Program.cs", line: 3, character: 7)] That line and character worries me But since this is generated then maybe it is fine?
Re: What's new in C# 12: overview
#23I feel that recent "features" are more in the "things I can do with a preprocessor or a code generator" than real language enhancements.
Of course, I can be (and I'm probably) extremely wrong, but I find that release pace exhausting and I see a lot of great software written without resorting to new "features".
Re: What's new in C# 12: overview
#24I stopped paying _a lot_ of attention to new C# features a few versions ago. While I like other syntaxes too (Python flexibility is really enjoyable), once my mind switches to "C# mode" I don't miss any other thing from more dynamic languages, at all. I feel that recent "features" are more in the "things I can do with a preprocessor or a code generator" than real language enhancements. Of course, I can be (and I'm pr…
Well, you can hack a lot with code gen, but thats not the way, imo.
But using your logic: are generics a feature? Since you could achieve almost identical results with code gen hacks
Re: What's new in C# 12: overview
#25I stopped paying _a lot_ of attention to new C# features a few versions ago. While I like other syntaxes too (Python flexibility is really enjoyable), once my mind switches to "C# mode" I don't miss any other thing from more dynamic languages, at all. I feel that recent "features" are more in the "things I can do with a preprocessor or a code generator" than real language enhancements. Of course, I can be (and I'm pr…
As someone that has spent far too much time in JS world any time I’m able to ditch a preprocessor or code generator is a a great relief. I want my build processes to be as simple and straightforward as they can possibly be.
Re: What's new in C# 12: overview
#26Re: What's new in C# 12: overview
#27Earlier quoted context omitted.
Yep. The issue with tests that are heavy on interfaces and mocks is that they are "too close" to the code - if refactoring is changing code while tests stay green, how can you refactor when any change to any method breaks a test? Swapping out interfaces to code-gened interceptors and keeping everything else the same, doesn't look like it would improve this underlying issue at all.
> how can you refactor when any change to any method breaks a test You fix until tests pass. How do you know you adjusted all tests when code changes and tests stay green?
Re: What's new in C# 12: overview
#28Not sure if I like primary constructors. TBH, the following feature of Dart that I like: class Point { public Point(this x, this y); int x; int y } Everything else seems like small quality of life improvements. And still patiently waiting for the following to be legal: int result = some_variable switch { a => callAFunctionReturningVoid(); 1, b => 2, };
Re: What's new in C# 12: overview
#29Earlier quoted context omitted.
What is the alternative specifically for unit tests? You can create integration and e2e tests that aren't as sensitive but I don't really understand what people are suggesting when they say mocking is bad in unit tests.
First: drop e2e, unit, etc distinction It is irrelevant and driven by some testing evangelists Tests are either quick or slow and may touch external stuff, thats mostly it. Whats wrong with mocks? If they lead to scenarios where your tests are green, but app doesnt work then it sucks. Ive witnessed projects with all green tests but app wasnt even waking.
Re: What's new in C# 12: overview
#30I stopped paying _a lot_ of attention to new C# features a few versions ago. While I like other syntaxes too (Python flexibility is really enjoyable), once my mind switches to "C# mode" I don't miss any other thing from more dynamic languages, at all. I feel that recent "features" are more in the "things I can do with a preprocessor or a code generator" than real language enhancements. Of course, I can be (and I'm pr…
> I feel that recent "features" are more in the "things I can do with a preprocessor or a code generator" than real language enhancements. As someone that has spent far too much time in JS world any time I’m able to ditch a preprocessor or code generator is a a great relief. I want my build processes to be as simple and straightforward as they can possibly be.