Live data from Hacker News

Welcome to C# 9.0

devblogs.microsoft.com

131–140 of 196 posts

Re: Welcome to C# 9.0

#131
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 asked the .NET Core team this yesterday during one of the Build talks, appearently data records can be defined as either class or struct and take on the same heap/stack allocation semantics as a regular class or struct.

My understanding is that structs are not always a good choice depending on the size of the data contained within because they are put on the stack, so having an immutable class record does not necessarily overlap with the use cases for structs.

It seems like records are more of a syntactic sugar which gives you a number of pre-defined behaviours such as value comparison and immutability by default (vs. regular classes).

Re: Welcome to C# 9.0

#132

Earlier quoted context omitted.

In C# I'd like to able to : - declare a namespace for the file (no indentation) - declare that the file is a class and can only contain one (top level) class (still no indentation) - `using` statements that don't import every symbol into my namespace : using System.Console; ... Console.WriteLine(); instead of : using Sytem; ... Console.WriteLine(); // where does "Console" come from ? god/IDE only knows But yes, no to…

You can do using Console = System.Console;

The point is : the C# namespaces, default behaviors and general usage, are only half of a good idea. Effectively importing every symbol in a namespace into the local namespace by default is so obviously bad.

Yes you can do `using Whatever = System.Console;`, fantastic, that's not the common idiom and it is harder to do (longer to write) than the usual idiom.

Re: Welcome to C# 9.0

#133

Earlier quoted context omitted.

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] publi…

Looking at object getter/setters in any OOP is likely to be pretty uninspiring :)

There's no logic there, this is basically just boilerplate for some other code to set properties on an object. Something that actually has some business logic will be much more interesting to read, eg.

https://github.com/PowerShell/PowerShell/blob/15c2245af97486...

Re: Welcome to C# 9.0

#134
post #41

Earlier quoted context omitted.

It's about trade off. A language that keep getting new features every year, will make some users happy, but will lose compiler speed and it will be harder to learn.

I love C# and have used it since the beginning (my online handles are often VisualCSharp), but I do worry about the cognitive burden of remembering idioms and dealing with multiple ways to do the same thing. This is already a huge issue with C++, and now it's slowly happening to C#. I work with many, many developers--some overseas--that are still in the string.Format era. The language is starting to show some warts d…

> The language is starting to show some warts due to inheriting bad decisions from former language maintainers (nullable value types and nullable reference types being treated completely differently).

That's being a little too harsh, in my opinion. Even if you were designing both kinds of nullable types right now, it'd be difficult to have them behave the same way without adding runtime support for keeping track of nullability of reference types. And that's quite a big task.

Re: Welcome to C# 9.0

#135
post #8

Earlier quoted context omitted.

C# is Microsoft Research's 20-year-long con to turn Java programmers into OCaml programmers so slowly that they don't notice.

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.

> C# is as verbose as it was years ago.

It isn't. Pretty much every release (including C# 9.0) adds some features that make your code more concise.

Re: Welcome to C# 9.0

#136

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 really is wonderful. Used it at work years ago and still miss it dearly. The only thing I don't miss is the lack of community. Many things you can get for free in Java/Python cost money in Microsoft land. Even common stuff like decent excel and PDF support. Its getting better but was still the case last time I looked. What C# needs is Java interop. The VM and bytecode structures are similar enough for it to work.…

Funny you should say that because I wrote an application that has both Excel and PDF output and both libraries were free on NuGet.

Re: Welcome to C# 9.0

#137
post #52

Earlier quoted context omitted.

I think kotlin is ugly hack, if you take away the superficial syntax (?) it will start showing ugly side. I think it only gotten popular because of Googles push due to Oracle Java lawsuit.

I don't think Kotlin is being pushed because of the Oracle lawsuit. Most of Oracle's complaints were at the VM and standard library level, which Kotlin doesn't help with.

Kotlin allows Google to hang out in Java 8 forever. If they want new features they can just add them at the Kotlin layer. Insulates them from OpenJDK and any changes Oracle wants to make. All great opportunities to fragment the Java ecosystem

Re: Welcome to C# 9.0

#138
post #113

Earlier quoted context omitted.

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)

JetBrains Rider is a fine IDE.

Re: Welcome to C# 9.0

#139

Earlier quoted context omitted.

> 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 t…

Thanks for the great info. Looks like it's time to take another crack at it.

Re: Welcome to C# 9.0

#140
post #75

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…

Didn't C# start with Microsoft poaching the lead Delphi architect from Borland? A lot of people loved Delphi back in the day for its design too.

It's funny, the languages I ended up using the most throughout the years are Delphi, C# and most recently Typescript (where Anders is also a lead architect). And my very first lines of code could very well have been written in Turbo Pascal (also by him), if I remember correctly.

As an aside, although common, I dislike the term "poaching" when it comes to hiring. It's negative connotations are inescapable, but also inappropriate when talking about hiring.

Post reply on HN