Earlier quoted context omitted.
Feels kinda crazy to see tuples and pattern matching "just arrive" when other languages have had them for years.
Sure. Like how streams "just arrived" in Java yet C# has had the equivalent for years. No language has every feature. C# is making enormous strides ahead of many of its counterparts.
What’s New in C# 7.0
181–190 of 278 posts
Re: What’s New in C# 7.0
#182CSharp once again showing it is the best language in terms of features and improvements. Great job all round by the designers.
That's a pretty sweeping generalization. Most of the headline features in the article are already in other languages e.g. Scala.
Re: What’s New in C# 7.0
#183Earlier quoted context omitted.
But then you might as well declare a class or structure to store the data. The point of tuples is to be self-contained.
It maybe wasn't clear, but I was referring to the parent's point about verbosity when using the 'old' Tuple class. using Complex = System.Tuple ; is less verbose than public class Complex { public double i { get; set; } public double j { get; set; } }
public class Complex {
private readonly double _i;
private readonly double _j;
public double I {get {return _i;}}
public double J {get{return _j;}}
public Complex(double i, double j){
_i = i;
_j = j;
}
}
But System.Tuple is also IComparable, IStructuralComparable, IStructuralEquatable. I haven't had enough coffee yet to add all the boilerplate for that to the above, which only reinforces the point about verbosity.Re: What’s New in C# 7.0
#184I tend to avoid using switch/case for quite irrational reasons. The break statement just looks wrong and I can't layout the code in a way I find at all pleasing. I'll almost always use a sequence of else if conditions instead. In my ideal world, it'd look like... switch (x) { case 1: { /* ... */ } case 2: case 3: { /* ... */ } } And before anyone points it out, switch is the same as else if when the thing being compa…
It's usually a good idea to create a new scope with your cases, so you can avoid some irritating variable name clashes, since, unlike and if, switch cases don't automatically do that, i.e.
switch(foo) {
case 0:
var bar = 2;
// do stuff...
break;
case 1:
var bar = 47; // error, conflicting variable name
// do stuff...
break;
}Re: What’s New in C# 7.0
#185CSharp once again showing it is the best language in terms of features and improvements. Great job all round by the designers.
> CSharp once again showing it is the best language in terms of features and improvements. That's a pretty sweeping generalization. Most of the headline features in the article are already in other languages e.g. Scala.
Re: What’s New in C# 7.0
#186Earlier quoted context omitted.
> But is C# really a language you want if that is important to you. C# is used by hundreds if not thousands of games by ways of Unity and is therefore demonstrably good enough in this scenario. Furthermore, just because a language is not C++ does not mean you shouldn't take every opportunity to give programmers tools to write fast code - at the end of the day I doubt anyone would be interested in a language that is p…
Isn't Unity stuck with C# 2.0 ?
public sealed class ExtensionAttribute : Attribute { }
Even async/await comprises of a convention and an interface - I haven't tried it, but in theory using the CLR 2.0 TPL should bring async/await your project. So far as I know, the feature being used for ref returns has always existed for C++/CLR so this stuff should work on CLR 2.0 (although you will need the C# 7.0 compiler).Re: What’s New in C# 7.0
#187CSharp once again showing it is the best language in terms of features and improvements. Great job all round by the designers.
I'd say Swift is more or less in line with C# with regards to functionality. Many new features added to C# seem to already exist in Swift. Swift could use some async/await mechanism en sometimes it's a bit annoying to typecast simple types for calculations, but otherwise Swift is a really sweet language to work with. Nonetheless C# is a nice language. I enjoy writing C# code, just as I enjoy writing Swift code.
(For starters, Swift desperately needs to include most of the points from "Generic Manifesto" to be comparable with more mature languages like C#. Not being able to return a generic interface from a function is just silly)
Re: What’s New in C# 7.0
#188Earlier quoted context omitted.
Edit-and-Continue is the greatest productivity feature ever added to a development stack for the real conditions one would encounter in large projects , and it astonishes me even now how misunderstood it's purpose is. Consulting has me moving jobs a lot and I encounter a veritable kaleidoscope of crappy work. Being able to correct minor issues in scope without restarting, while ten form posts deep in an archaic webfo…
Does Edit-and-Continue ever work? I'm curious, because I'm almost always forced to build x64-only, because of some libraries we have to use that are 64-bit only, and I've never been able to change code while the debugger is running. Supposedly it is supposed to work in VS 2015, but I'm not seeing it - it's always the nasty messagebox saying "Changes to 64-bit applications are not allowed"
I only ask as I can usually manage 32-bit builds on dev while working, then just test there's no spooky differences when I target 64-bit.
There are issues with some projects that aren't well documented. E+C on web apps on local or remote IIS are a no-go (at least to the best of my knowledge), whereas if you can target IIS express during development it works beautifully.
I've always found that the juice has been worth the squeeze, for values of squeeze that only require me to tweak configuration for my dev box.
Re: What’s New in C# 7.0
#189 match(shape)
{
case Rectangle r
return r.With*r.Height;
case Circle c
return pi*c.Radius*c.Radius;
}