Live data from Hacker News

Welcome to C# 9.0

devblogs.microsoft.com

111–120 of 196 posts

Re: Welcome to C# 9.0

#111
post #106

Earlier quoted context omitted.

Oh, cool, I didn't notice that! Still, they are playing catch-up here.

I mean... if you go that route then I would say Kotlin isn't really ready to be used as a production language in most places due to the severe lack of tooling, especially when it comes to things like static analysis. Sure ktlint is there, but the rules library is lacking. So from that perspective, Kotlin is playing catch-up.

Discussion was about the design of the language only.

Re: Welcome to C# 9.0

#113

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…

It's by far my favorite general purpose language. Works well everywhere, and the best tools around.

C# is a very good language. I like it a lot, and Visual Studio is a fine IDE, but the tools pale in comparison to the JVM tools (Maven, Gradle, IntelliJ, Eclipse, Spring Boot, GraalVM, etc)

Re: Welcome to C# 9.0

#115

What is an example of a really good codebase written in modern C#? There are quite a few appealing things about the language, but I'm having trouble shaking the feeling that it's kind of like Java. I know both languages have evolved a lot, but some codebases might get stuck in some old patterns.

My understanding is that the dotnet runtime and powershell are both decent codebases. https://github.com/dotnet/runtime https://github.com/PowerShell/PowerShell

Looking at a random file in Powershell, the first thing I see is:

    private string _typeName;
    /// 
    /// Add new type name to the specified object for TypeNameSet.
    /// 
    [Parameter(Mandatory = true, ParameterSetName = "TypeNameSet")]
    [Parameter(ParameterSetName = "MemberSet")]
    [Parameter(ParameterSetName = NotePropertySingleMemberSet)]
    [Parameter(ParameterSetName = NotePropertyMultiMemberSet)]
    [ValidateNotNullOrEmpty]
    public string TypeName
    {
        set { _typeName = value; }
        get { return _typeName; }
    }
-- https://github.com/PowerShell/PowerShell/blob/15c2245af97486...

Honestly it seems like just a lot of code and very little meaning. I can't help but think that there's a better way of expressing the solution.

I could have picked the wrong file, but I was poking around in lots of directories before I found any significant C# code at all. It seems like there's a whole 'nother level of boilerplate in the directory structure.

Re: Welcome to C# 9.0

#116
post #97

This is like reading through a list of Christmas presents I didn't even know I wanted. Relational/Logical patterns are going to revolutionize our ability to make high-level business logic even more accessible to non-wizards. The switch expressions introduced in 8.0 were already very nice for building out our complex in-line mapping code. This takes things to a completely different dimension. I will say that I am a li…

I’m also confused on the relationship between records and structs. I’m guessing in practice it has some of the properties of classes and some of the properties of structures, but I worry it’s just going to complicate things. It’s not like all the old structs in the BCL will just go away.

Wouldn't a Struct be passed by value and Record (as a class) be passed by reference. Kind of strange to pair immutability with pass by reference.

Re: Welcome to C# 9.0

#117
post #97

This is like reading through a list of Christmas presents I didn't even know I wanted. Relational/Logical patterns are going to revolutionize our ability to make high-level business logic even more accessible to non-wizards. The switch expressions introduced in 8.0 were already very nice for building out our complex in-line mapping code. This takes things to a completely different dimension. I will say that I am a li…

Isn't a big distinction of structs the fact that they are value types (and thus allocated on the stack) rather than reference types allocated on the heap?

Re: Welcome to C# 9.0

#118

Earlier quoted context omitted.

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.

Newtonsoft (and the new Microsoft .NET framework JSON (de)serializer) only uses the setters once too to set the properties after processing the JSON, I can't see it causing an issue.

Re: Welcome to C# 9.0

#119

Earlier quoted context omitted.

It's by far my favorite general purpose language. Works well everywhere, and the best tools around.

> Works well everywhere Perhaps it's gotten better - TBH I haven't checked in years - but it used to be a horrible bug ridden mess for doing things aimed at Linux (i.e. via mono).

To answer your question first: It's faster on Linux than Windows now (marginally) and completly stable on Linux. I've been running a .net core systemd service for 9 months with 0 downtime (not using the new HostedService class though). It hasn't leaked any memory at all, it's still running perfectly even though it opens thousands of files and thousands of connections to a web service every hour.

It's just a process that picks zip files from the local SFTP service, sends each entry in the zip to an external web service, and writes the result of the file to a new zip in the SFTP directory. Extremely simple, but also the kind of application in which resource leaks become apparent very fast, and it's been far more stable than anything we had on Windows where we had to reboot servers once a month just as a precaution.

A few years ago I was playing with Kotlin when it had been recently released, and I remember thinking that eventually it would be a likely candidate as a default language for new enterprise projects. My reasoning was based mostly on it being a better Java, it solved just the right problems but wasn't too different and thus easy to learn. And at the time the JVM had too many advantages over .NET (multi plataform, open source, supported every technology under the sun)

Fast forward a few years, and .net now supports Linux natively, and is even faster on Linux than Windows. Microsoft has or is open sourcing pretty much everything, and with the rise of Nuget the third party library ecosystem has grown by leaps and bounds. C# has become an amazing language, considering that back in 2000 it was basically Java. While Oracle has regressed and is oppressing the ecosystem in its typical ways.

Even though I still like Kotlin better (purely from a language design standpoint), C# has evolved so much it nearly matches it, while Java is just a kitchen sink of non-cohesive features and libraries. C# in 2020 almost seems as it was designed from the ground up to be a semi-functional asynchronous OOP language with reifed generics, linq, async / await, null safety, and many more features.

That is absolutely mind boggling, because it is a language that made nearly all the mistakes that the originally Java did back in the days (save checked exceptions), and now a days I think it should pretty much be the default plataform for any app that needs to interact with enterprise technologies, and should honestly be considered in all green field projects if the team has development expertise in it. We've stopped being a mix shop and are now pretty much .net exclusively.

Re: Welcome to C# 9.0

#120
post #61

Look - I don't have anything deep to say here. I can only say that between 'records' and 'with-expressions' now in C#, I as a hobbyist F# developer feel like I'm being shaken down by the mafia. C# designers: "Hey, nice language features you have there. I'll just borrow them for a bit ok, it'll be fine..." Later, C# programmers: "why would I learn F#, C# does all the same stuff!" (even though it doesn't) Edit: I admit…

C# takes the nice features of F# and implements in a slightly worse way.
Post reply on HN