Live data from Hacker News

Welcome to C# 9.0

devblogs.microsoft.com

31–40 of 196 posts

Re: Welcome to C# 9.0

#31
post #10

Well, we're getting closer to F#. Still waiting on discriminated unions and expression blocks. (Yes, I know, discriminated unions in F# are just implemented in the class hierarchy. But it's awfully nice syntactic sugar.) > Point p = new (3, 5); At first glance, not impressive, since you could just do: > var p = new Point(3,5); However, it would clean up code like: > graphics.DrawRectangle(RedBrush, new(3, 5, 2, 2))

> graphics.DrawRectangle(RedBrush, new(3, 5, 2, 2)) > graphics.DrawRectangle(RedBrush, new Point(3, 5, 2, 2)) what's the advantage of the first example? i prefer the second, because i don't have to look at the definition of DrawRectangle in order to know that the second argument is a 'Point' object.

Someone in the comments also mentioned array initializers, arguably a better use of the feature.

Re: Welcome to C# 9.0

#32

Earlier quoted context omitted.

With Kotlin and Scala in existence, that ain’t going to happen. C# is as verbose as it was years ago. After years of Scala collections, eithers, options, why would anybody consider C#. Just look at plumbing with init, data records and with. That is what a case class with val properties in Scala gives. But congratulations to the team on shipping v9.

Because Scala takes mind-boggingly long to compile. Because Scala has so many features that anything has at least 3 different ways to implement it. Because it’s very easy to write unreadable code in scala, not so much in C#. Because Scala uses JVM, while C# has access to .NET (yes this is an advantage for many developers).

> Because Scala has so many features that anything has at least 3 different ways to implement it.

Thankfully that problem doesn't exist with C# /s

Re: Welcome to C# 9.0

#33
What is the winforms simple (ie, drag and drop form designer, click through for code) current windows development recommendation. I've seriously lost all track of how to just get up and going. I've tried UWP/WPF etc - they felt like a bit of nightmare for quick and go, but the tooling now seems to have dropped winforms? I couldn't get the form designer to actually show up even on a WinForms project?

Re: Welcome to C# 9.0

#34
post #19

Earlier quoted context omitted.

> graphics.DrawRectangle(RedBrush, new(3, 5, 2, 2)) > graphics.DrawRectangle(RedBrush, new Point(3, 5, 2, 2)) what's the advantage of the first example? i prefer the second, because i don't have to look at the definition of DrawRectangle in order to know that the second argument is a 'Point' object.

The second argument is a Rectangle, which means you'd be repeating 'Rectangle' twice in one line with the second style.

[deleted]

Re: Welcome to C# 9.0

#35

Earlier quoted context omitted.

With Kotlin and Scala in existence, that ain’t going to happen. C# is as verbose as it was years ago. After years of Scala collections, eithers, options, why would anybody consider C#. Just look at plumbing with init, data records and with. That is what a case class with val properties in Scala gives. But congratulations to the team on shipping v9.

Because Scala takes mind-boggingly long to compile. Because Scala has so many features that anything has at least 3 different ways to implement it. Because it’s very easy to write unreadable code in scala, not so much in C#. Because Scala uses JVM, while C# has access to .NET (yes this is an advantage for many developers).

All your points except the last one do not apply to Kotlin

Re: Welcome to C# 9.0

#36
post #17

How does the .NET ecosystem fare these days compared to Java's? Whatever the differences between the languages, on the surface of things it looks like one must be insane not to use Java: https://projects.apache.org/projects.html?language

.NET ecosystem is large, but still windows-centric. If I was choosing between java and C# for a startup, I'd definitely consider C# because it does seem to be a better java (properties and LINQ are the first 2 things that come to mind). But realistically if you're not doing .NET on windows, you're still an early adopter who's going to run into weird issues that you won't have to deal with on java.

> windows-centric

.NET 5 is going to change this completely. .NET Core has already changed.

Re: Welcome to C# 9.0

#37

> " Top-level programs " I'm not usually one for causal dismissals but that made me cringe. What on earth is the use case for getting rid of that tiny bit of boilerplate, relative to the complexity it adds to the language definition, that makes it worthwhile?

I like it.

Can you open a text editor and get going with C#? Now you easily can. iPython and python notebooks gained lots of traction from just this type of simplicity.

If you were to write a "script" using the language, doing some things just top level is simple. Very pragmatic. I ALSO like that it's an error to call to any top level functions outside of this, so it keeps this from exploding complexity everywhere.

Re: Welcome to C# 9.0

#38

I still think C# is one of, if not the best of designed languages exist. Even it moves in much smaller steps than it was before I think it's for good. I left .NET land at 6.0 and .NET 4.x versions mostly because of Windows eco-system (small open source community, almost no alternatives to out of the MS things, bad linux support). Since that I've been working with Java, Swift,JS, Python, Golang and I still think that…

To me C# is the second best designed language, the first being IMHO Kotlin. I'm very interested in what you think would make C# more well designed than the latter :}

May I ask why do you think kotlin is best designed?

Re: Welcome to C# 9.0

#39
post #17

How does the .NET ecosystem fare these days compared to Java's? Whatever the differences between the languages, on the surface of things it looks like one must be insane not to use Java: https://projects.apache.org/projects.html?language

.NET ecosystem is large, but still windows-centric. If I was choosing between java and C# for a startup, I'd definitely consider C# because it does seem to be a better java (properties and LINQ are the first 2 things that come to mind). But realistically if you're not doing .NET on windows, you're still an early adopter who's going to run into weird issues that you won't have to deal with on java.

The point of C# being a better Java is nowadays mostly obscolete because of Kotlin being THE better Java. As for LINQ see https://github.com/mythz/kotlin-linq-examples/blob/master/RE...

Re: Welcome to C# 9.0

#40

That "Init-only properties" feature is huge. I spend so long at work when working on tests making stubs of objects with private setters etc (e.g. DTOs). That work is essentially gone now, awesome!

It also drove me mad with JSON deserialization. Hopefully this will work nicely with newtonsoft.

I think they said it was only a compiler error, it's still a normal setter underneath, so newtonsoft would not see any difference.
Post reply on HN