Live data from Hacker News

What’s New in C# 7.0

blogs.msdn.microsoft.com

1–10 of 278 posts

Re: What’s New in C# 7.0

#2
Out variables seem like a mis-feature, especially when they are adding a better alternative (Tuples) in the same release.

It's great to finally have tuples, but the c/java style syntax is showing it's age compared to something like scala which has return type declarations at the end, which I find much more readable.

Literal improvements will be a godsend for writing database migrations.

Ref returns and locals look like a source of constant headaches. It's much harder to reason with code when the data can be modified by random others bits of code. Currently I can look for all references to an array to find everywhere that modifies it now I can't.

Re: What’s New in C# 7.0

#4
post #2

Out variables seem like a mis-feature, especially when they are adding a better alternative (Tuples) in the same release. It's great to finally have tuples, but the c/java style syntax is showing it's age compared to something like scala which has return type declarations at the end, which I find much more readable. Literal improvements will be a godsend for writing database migrations. Ref returns and locals look li…

>Out variables seem like a mis-feature, especially when they are adding a better alternative (Tuples) in the same release.

You can't retro-fit multiple-returns (via Tuples) onto existing library functions, so for places where you're forced into using out parameters, this is a slight improvement.

Re: What’s New in C# 7.0

#5
post #2

Out variables seem like a mis-feature, especially when they are adding a better alternative (Tuples) in the same release. It's great to finally have tuples, but the c/java style syntax is showing it's age compared to something like scala which has return type declarations at the end, which I find much more readable. Literal improvements will be a godsend for writing database migrations. Ref returns and locals look li…

[deleted]

Re: What’s New in C# 7.0

#6
post #2

Out variables seem like a mis-feature, especially when they are adding a better alternative (Tuples) in the same release. It's great to finally have tuples, but the c/java style syntax is showing it's age compared to something like scala which has return type declarations at the end, which I find much more readable. Literal improvements will be a godsend for writing database migrations. Ref returns and locals look li…

I've seen some p/invoke examples where out variables are used as a c pointer.

Re: What’s New in C# 7.0

#7
It looks like they've added a lot of rope to hang ourselves with typos.

    int myvar, I;
    foo(out int mvar); // oops, not myvar; maybe caused by a refactor?
    bar(out *); // oops, not I; was up too late coding
And so on. Things like this would be easily missed when reading code at-a-glance, and it's this sort of bug that arises often in languages that allow implicit declaration of variants.

Re: What’s New in C# 7.0

#8
post #2

Out variables seem like a mis-feature, especially when they are adding a better alternative (Tuples) in the same release. It's great to finally have tuples, but the c/java style syntax is showing it's age compared to something like scala which has return type declarations at the end, which I find much more readable. Literal improvements will be a godsend for writing database migrations. Ref returns and locals look li…

> it's age compared to something like scala which has return type declarations at the end, which I find much more readable.

Scala or .... VB.net!

Re: What’s New in C# 7.0

#9
post #7

It looks like they've added a lot of rope to hang ourselves with typos. int myvar, I; foo(out int mvar); // oops, not myvar; maybe caused by a refactor? bar(out *); // oops, not I; was up too late coding And so on. Things like this would be easily missed when reading code at-a-glance, and it's this sort of bug that arises often in languages that allow implicit declaration of variants.

R# should warn "unused variable myvar" on the first one.

You'll get a compiler error if you try and use `I` uninitialized.

Not saying you're wrong, just having trouble getting worried about this. You can make typos now:

    int x, y;
    foo(out x, out x); // oops, not y; was up too late coding

Re: What’s New in C# 7.0

#10
Like everything except "Ref returns and locals".

I don't think I've ever seen a case where I wished for that feature.

All the other things - tuples, anonymous out vars, pattern matching - I've found myself wanting quite often.

Post reply on HN