Live data from Hacker News

.NET Core 3.0

devblogs.microsoft.com

11–20 of 183 posts

Re: .NET Core 3.0

#11

Now you can easily write the following state machine in C#: static State ChangeState(State current, Transition transition, bool hasKey) => (current, transition) switch { (Opened, Close) => Closed, (Closed, Open) => Opened, (Closed, Lock) when hasKey => Locked, (Locked, Unlock) when hasKey => Closed, _ => throw new InvalidOperationException($"Invalid transition") };

To be clear, this has nothing to do with .NET Core 3.0 but rather is a feature of C# 8.0, which depends on compiler support that can be targeted to any previous version of .NET Core or Framework, all the way back to Framework 2.0 (tested myself, although MS says not to target 2.0 or 3.5).

Re: .NET Core 3.0

#12

> Nullable enables you to directly target the flaws in code that lead to NullReferenceException. The lowest layer of the framework libraries has been annotated, so that you know when to expect null. I hope Java gets this one day.. would be a cool feature

Optional ? But redoing the standard lib would be no go in javaland ? It's the non nullable reference I find interesting.

The API hasn’t changed, and remains backwards compatible. However it has been annotated, so that when targeting it with a compiler configured to validate/verify nullability you get a better (read: safer) experience. It can configured as an error or a warning.

MS does this sort of thing a good amount, preserving backwards compatibility but enhancing the experience.

Re: .NET Core 3.0

#15
post #13

List of performance improvements is mind-boggling: https://devblogs.microsoft.com/dotnet/performance-improvemen... How could a mature standard library / frameworks have so much performance gains to be had?

Well, in the traditional desktop space performance was not that critical as it is with cloud deployments. Also hardware intrinsics are a new toy they have available.

Re: .NET Core 3.0

#16
post #5

What's crazy is that this is what C# should have always been. I was into Mono way back because I thought niavely it was going to be more successful, but I think if C# had gone this route earlier -> the whole python / go etc popularity boom might have been softer and MS would have had a first class player that would have increase # of folks easily able to build in windows. That and I never got to develop successfully…

I’ve thought about this but I doubt it. The big change has been the perception shift. .NET was always really solid tech. Microsoft has always had stellar developer technology. But the love affair with open source and the super villain role that Microsoft played, is what kept people away, not the tech itself. I remember wanting to give a talk about how amazing C# was to a ruby group. I never did it, but it was definit…

Totally agree. The tech was so awesome that it lured Miguel de Icaza away from Gnome.

Re: .NET Core 3.0

#17

Now you can easily write the following state machine in C#: static State ChangeState(State current, Transition transition, bool hasKey) => (current, transition) switch { (Opened, Close) => Closed, (Closed, Open) => Opened, (Closed, Lock) when hasKey => Locked, (Locked, Unlock) when hasKey => Closed, _ => throw new InvalidOperationException($"Invalid transition") };

Still no exhaustiveness checking like a true match expression unfortunately, which is what would give it parity against the traditional subclass/polymorphic approach.

Re: .NET Core 3.0

#18
post #13

List of performance improvements is mind-boggling: https://devblogs.microsoft.com/dotnet/performance-improvemen... How could a mature standard library / frameworks have so much performance gains to be had?

I think it's a combination of monopoly effects plus the benefits of open source: back when .NET was closed-source and only available on Windows, the only way to ship a performance improvement was if an individual developer at Microsoft could convince his boss it was worth it. And it was rarely worth it, because .NET only ran on Windows, its only customers were .NET-only enterprise shops who weren't about to move to an entirely new framework because of perf problems, and there was always a long list of feature requests that PMs would give priority to.

But now that .NET runs everywhere, it has to compete with projects that have been shipping performance improvements all along. Happily, since it's now open-source too, it can accept those changes from anyone.

Re: .NET Core 3.0

#19
post #17

Now you can easily write the following state machine in C#: static State ChangeState(State current, Transition transition, bool hasKey) => (current, transition) switch { (Opened, Close) => Closed, (Closed, Open) => Opened, (Closed, Lock) when hasKey => Locked, (Locked, Unlock) when hasKey => Closed, _ => throw new InvalidOperationException($"Invalid transition") };

Still no exhaustiveness checking like a true match expression unfortunately, which is what would give it parity against the traditional subclass/polymorphic approach.

Heard it’s being championed for C# 9.

Re: .NET Core 3.0

#20
post #5

What's crazy is that this is what C# should have always been. I was into Mono way back because I thought niavely it was going to be more successful, but I think if C# had gone this route earlier -> the whole python / go etc popularity boom might have been softer and MS would have had a first class player that would have increase # of folks easily able to build in windows. That and I never got to develop successfully…

I’ve thought about this but I doubt it. The big change has been the perception shift. .NET was always really solid tech. Microsoft has always had stellar developer technology. But the love affair with open source and the super villain role that Microsoft played, is what kept people away, not the tech itself. I remember wanting to give a talk about how amazing C# was to a ruby group. I never did it, but it was definit…

I actually went from C# (WebForms) to Ruby (Rails) and then back to C# (MVC).
Post reply on HN