Hacker News new | ask | show | jobs
by drfrank 4491 days ago
The article referenced by this article lists nine features of which eight are syntactic sugar. (Being able to declare the out parameter in place has a very minor but significant impact: Preventing abuse of a variable intended to be used as the out parameter.)

It's disappointing to see the team spend its time on so many minor features rather than tackling fewer major improvements.

I'm sure we all have our pet features. My wish would be structural typing: Very few of the C# developers I've worked with in the past couple of years have embraced isolation testing. A significant reason is the frustration with "extra" interfaces and the distractions they introduce in code navigation. Anything that eases the the uptake of isolation testing would dramatically improve software quality, which as we know, would dramatically improve our efficiency.

1 comments

Structural typing would be nice. My wish would be algebraic data types. I'm not sure how that would even work in c# but its what I want :)

I tend to avoid using out parameters. I've written extension methods to replace the typical out param framework methods.. For example, instead of int.parse(string s, out int i), we have "123".TryParse<int>(), which returns a nullable int. instead of TryGetValue on dictionary, we have GetOrDefault(key, optional default val) and GetOrDefaultAsNullable(key).

I think the new out parameter syntax is an improvement, but I'm still on the fence about whether out parameters are even a good idea when we can instead return a single type that encodes the same information.

I'd be interested in hearing other viewpoints on this.