Live data from Hacker News

What's New in C# 6.0 [video]

channel9.msdn.com

51–60 of 145 posts

Re: What's New in C# 6.0 [video]

#51
post #13

I'm going to take some hits for that but... with .NET being open source (never liked Mono..) and all.. I'm tempted to use C# in the future again. Using it on Windows has always been good - and now that it compiles to native code too and that the libs are open....

Why would you take hits for doing something in a language you like?

Re: What's New in C# 6.0 [video]

#52

Still hoping they add the !(non-nullable) operator. I know its hard http://blog.coverity.com/2013/11/20/c-non-nullable-reference... But dang I would appreciate it. So much code is cluttered with null checks that increases the robustness of the code at the cost of correctness, readability, and poorly defined behavior.

In my limited C# experience I found `int?` to be really nice, and an operator to non-null it sounds even nicer.

I wonder if there is any chance of Rust getting an abbreviation like `?` so you can write `int?` instead of `Option`. I'm just starting to explore the language, but it seems like a lovely addition.

Re: What's New in C# 6.0 [video]

#53
post #13

I'm going to take some hits for that but... with .NET being open source (never liked Mono..) and all.. I'm tempted to use C# in the future again. Using it on Windows has always been good - and now that it compiles to native code too and that the libs are open....

I thought that native compilation was only for "Windows Store" apps. Do they now have that available for regular Windows desktop apps too (or more importantly, server-side Linux apps)?

Native code will be supported across the board for Windows 10 devices,

http://www.hanselman.com/blog/AnnouncingNET2015NETAsOpenSour...

Unless Windows Desktop is meant as store applications.

Re: What's New in C# 6.0 [video]

#54
post #18

While all of the changes look nice in terms of writing less code, they are the kind of syntactic sugar I learned to hate in CoffeeScript. Mostly because the code was so much denser and harder to read. Especially when reading other people's code. As I write more and more code, the more I want simplicity and ease of understanding over typing a few less characters or having more elegant code.

The vast majority of these changes are very understandable. The only one that is complex is the ? operator, which compresses only code that is very uninteresting and harder to read.

Comparatively the string trick, read-only properties and lambda syntax for simple methods seem very easy to digest.

Re: What's New in C# 6.0 [video]

#55
They need to add these:

https://github.com/MiniProfiler/dotnet/blob/master/StackExch...

They're extremely useful and intuitive string helper methods. Truncate(), IsNullOrWhiteSpace(), etc are things I use daily. And while you can type string.IsNullOrWhiteSpace(string) that is annoying and counter-intuitive.

Re: What's New in C# 6.0 [video]

#56

They need to add these: https://github.com/MiniProfiler/dotnet/blob/master/StackExch... They're extremely useful and intuitive string helper methods. Truncate(), IsNullOrWhiteSpace(), etc are things I use daily. And while you can type string.IsNullOrWhiteSpace(string) that is annoying and counter-intuitive.

IsNullOrWhiteSpace() was added in dot net 4: http://msdn.microsoft.com/en-us/library/system.string.isnull...

I agree that Truncate would be a nice one to include in the core.

Re: What's New in C# 6.0 [video]

#57
post #21
post #18

While all of the changes look nice in terms of writing less code, they are the kind of syntactic sugar I learned to hate in CoffeeScript. Mostly because the code was so much denser and harder to read. Especially when reading other people's code. As I write more and more code, the more I want simplicity and ease of understanding over typing a few less characters or having more elegant code.

As I write more and more code, the more I want simplicity I had a 24 year old developer report to me that apparently thought his bonuses were tied to how many operations he did on a single line of code. He consistently wrote unbelievably complex lambda expressions with multiple conditional operators that would make a single line take up at least 1.5 screenfulls in Visual Studio on a 1920x1080 resolution monitor. Thes…

Over the board or just expressive? http://programmers.stackexchange.com/a/261893

Re: What's New in C# 6.0 [video]

#59

They need to add these: https://github.com/MiniProfiler/dotnet/blob/master/StackExch... They're extremely useful and intuitive string helper methods. Truncate(), IsNullOrWhiteSpace(), etc are things I use daily. And while you can type string.IsNullOrWhiteSpace(string) that is annoying and counter-intuitive.

IsNullOrWhiteSpace() was added in dot net 4: http://msdn.microsoft.com/en-us/library/system.string.isnull... I agree that Truncate would be a nice one to include in the core.

> IsNullOrWhiteSpace() was added in dot net 4:

Look at what the helper actually does. I already addressed this in my comment.

     string hello = magic();    
     if(hello.IsNullOrWhiteSpace()) 
     { ... }
Is significantly more intuitive than:

     string hello = magic(); 
     if(string.IsNullOrWhiteSpace(hello))
     { ... }
Plus it is consistent with things like Contains("XYZ") (e.g. hello.Contains("something")).

Truncate is useful just because Substring() throws a bunch of dumb exceptions. It is mostly a workaround for Substring's poor design.

Re: What's New in C# 6.0 [video]

#60
post #18

While all of the changes look nice in terms of writing less code, they are the kind of syntactic sugar I learned to hate in CoffeeScript. Mostly because the code was so much denser and harder to read. Especially when reading other people's code. As I write more and more code, the more I want simplicity and ease of understanding over typing a few less characters or having more elegant code.

I'm with you, both for your reasons and for another: it makes code harder to teach. "Oh, you'll see this. And this. And this . . . There's this, but no writes it that way. This is idiomatic."

There's some of this in all languages, of course, but "this bit of sugar will make the code cleaner and easier to read" assumes that everyone will adopt a new set of idioms wholesale (which they usually don't).

Post reply on HN