Live data from Hacker News

What’s New in C# 7.0

blogs.msdn.microsoft.com

71–80 of 278 posts

Re: What’s New in C# 7.0

#71

Sometimes it feels like we're entering a new age of coding. C# is so full of "features" that code refactoring tools like ReSharper, CodeRush and JustCode became simply indispensable. It is quite hard to be sure, every time, what is the most elegant/compact way of doing things. In the .Net/VisualStudio world, the language tooling (Intelisense, visual drawing XAML & WinForms, etc) became as important as the language se…

That type of programming never went away.

That is what I was doing on Windows 3.x and have done while coding in Mac OS X and Windows.

Also the reason I never quite adapted to UNIX mentally of VI/Emacs.

Even though I have spent enough years coding for UNIX that me and Emacs are quite old acquainted with each other.

Re: What’s New in C# 7.0

#72
post #65

Is 6.0 widely used in industry/open source?

At my work I do a lot with 3.5 still. We need to upgrade our version of devexpress. More recent projects use MVC with .Net 4.0 or 4.5 (but our IT guy is nervous about installing such new runtimes on the servers that don't have 4.5 already..)

We use VS2012

Re: What’s New in C# 7.0

#73

Nice! I was also hoping for some sort of guaranteed not-nullable type and immutable classes. Maybe in C# 8.

F# has guaranteed not-nullables, except when you do default it returns null. That said, it generally works well in well-defined situations but any time there's deserialization it's often a bigger mess than just never assuming not-null.

I think it's a problem that needs to be solved in the CLR, not C#, and my guess is it probably never will be.

Re: What’s New in C# 7.0

#74

Pattern matching! Tuples! Awesome, C# 7.0 is scratching two itches I've felt every time I've worked with it. If only .NET had a suitable cross-platform UI toolkit, then I'd be using it everywhere. Eto.Forms is a good attempt but I found rather buggy and limited at this point in development. Avalonia, while further along in terms of stability and features, doesn't even try to fit in with any platform's look and feel.

Feels kinda crazy to see tuples and pattern matching "just arrive" when other languages have had them for years.

What's your bar for "other language"? Remember that C# is a mainstream language, with all that entails in terms of stability and conservatism of language design (and the other way around - it's popular partly because it's conservative). Comparable languages are Java, C++ and the like; and in that category, C# is, generally speaking, more on the "progressive" end of the spectrum. Comparing it to something like Scala is rather apples and oranges.

Re: What’s New in C# 7.0

#75
post #53

Earlier quoted context omitted.

A big advantage of this design over most of the other languages with tuples that I've seen is that their members can have names - that is, types can be anonymous but have named members. This I think hits a sweet spot as it's rare to not want fields to have names, but fairly common to want intermediate types that just bundle a few fields together where there's no good name that clarifies much.

Anonymous items with named fields are always only just one name away from being structs. That seems to me to be the least -sweet spot in the possibilities of (named/anonymous item) x (named/anonymous fields).

It's a very big step in a language with nominal typing. Tuples with named fields are compatible (even across assemblies, if I remember correctly) so long as order, names and types match. Structs are not compatible in that manner.

Re: What’s New in C# 7.0

#76
post #66

Earlier quoted context omitted.

Hey there, C# language designer here. > Out variables seem like a mis-feature, especially when they are adding a better alternative (Tuples) in the same release. Out variables are really great when working with existing code that predates Tuples (for example, the entire BCL). We don't just introduce language features that will only work well for new code. We also want to make the experience of coding against existing…

> That 'headache' has to be weighed against the needs of some parties to write very fast code and to have as little overhead as possible. ref returns enables a much more pleasant coding experience that enables these sorts of speedups in these specialized scenarios. I'm worried this could result in a loss of focus, you can't make everyone happy all the time. c# is a fantastic language to develop applications in (web o…

The Midori project proved otherwise.

One of the reasons we are stuck with C and C++ is because other language vendors, including Microsoft, dropped the ball regarding performance of type safe languages.

Do you think C++ would have been kept around if Java and the CLR had been AOT compiled to native code with focus on compiler optimisations since day one?

I really appreciate the efforts of the .NET team in adopting the Midori lessons in the standard .NET stack.

Re: What’s New in C# 7.0

#77

Sometimes it feels like we're entering a new age of coding. C# is so full of "features" that code refactoring tools like ReSharper, CodeRush and JustCode became simply indispensable. It is quite hard to be sure, every time, what is the most elegant/compact way of doing things. In the .Net/VisualStudio world, the language tooling (Intelisense, visual drawing XAML & WinForms, etc) became as important as the language se…

I don't know about that. I'm working on a codebase that heavily uses C# 6.0 features, and for the most part, the "most elegant/compact way of doing things" is disseminated via code reviews, and quite fast at that. Convenient things stick around and become idiomatic precisely because they're convenient.

Then again, you don't have to always go for the most elegant/compact thing, either.

Re: What’s New in C# 7.0

#78
post #19

Since C# is starting to look more like JavaScript (i.e. local functions) and vice versa (i.e. arrow aka lambda expressions). I'm going to throw my pocket change into a couple features I've been growing old hoping to see: 1. Regex expressions just like Regexp in JS: /^\s+$/.IsMatch(" "); // or Regex r = /^\s+$/; 2. DateTime expressions, similar to regex, something like: DateTime clockTowerLightning = #1955/11/12 10:04…

Algol and Lisp already had local functions....

Re: What’s New in C# 7.0

#79
post #72
post #65

Is 6.0 widely used in industry/open source?

At my work I do a lot with 3.5 still. We need to upgrade our version of devexpress. More recent projects use MVC with .Net 4.0 or 4.5 (but our IT guy is nervous about installing such new runtimes on the servers that don't have 4.5 already..) We use VS2012

Feel your pain. My work laptop has VS2012 on it.

Last year we were still targeting XP.

Re: What’s New in C# 7.0

#80
post #23

I wish they did not call it pattern matching. Instead this is more like Destructuring combined with Switch. the guarantees are different

If you look at the original specs on Roslyn GitHub, it started as a more generalized extensible pattern matching system (tying into destructuring). I would imagine that this is still in the plans, but it just didn't fit into this version.
Post reply on HN