News for hackers. Stuff that matters.
Re:JavaScript Structs by dgellow on Thursday October 10, 2024 @04:01PM (#41802907)
Do you have examples of unreadable C#? The language didn’t change much IMHO. You have new features, like records, but C# code looks pretty much like what I started with in 2009
Re:JavaScript Structs by leetharris on Thursday October 10, 2024 @04:19PM (#41803106)
Now that I'm thinking about it, most of it is probably .NET bloat instead of C# bloat, but a few examples would be global usings, file scoped namespaces, records, target-typed new expressions, null coalesce assignments, etc. It's nothing huge, but combined with .NET bloat it can be overwhelming when you haven't worked in .NET for a while.
Re:JavaScript Structs by jenscow on Thursday October 10, 2024 @04:57PM (#41803519)
and pattern matches, primary constructors, range operator, switch expressions, etc. it does add up
Re:JavaScript Structs by eknkc on Friday October 11, 2024 @03:33AM (#41807185)
I came to love pattern matching so much that now when I write TypeScript I get frustrated. It is a weird balance.
Re:JavaScript Structs by dgellow on Saturday October 12, 2024 @08:12AM (#41818529)
All of this looks and feels like C#. That doesn’t look unreadable or a completely different language. In fact they end up making C# more readable by removing boilerplate
Re:JavaScript Structs by wvenable on Thursday October 10, 2024 @11:54PM (#41805929)
All the things you describe make C# more readable and easier to understand!

Are you really confused by file scoped namespaces or target-typed new or even null coalesce assignments?

You don't have to use them -- although Visual Studio will helpfully suggest places you can use them.

If I had never seen a pattern match switch statement before (and there was a point where I didn't) it's sort of immediately obvious what it does.

Re:JavaScript Structs by francisofascii on Thursday October 10, 2024 @05:05PM (#41803580)
This one threw me off when I first saw it:

(int x, string y) = (default, default);