News for hackers. Stuff that matters.
Re:A Preview of C# 8 [video] by nxc18 on Friday August 25, 2017 @11:56AM (#15099396)
There's some interesting and controversial stuff in here. I am very excited about extension everything. I also like the new extension method syntax; much cleaner and a much clearer expression of intent.
Re:A Preview of C# 8 [video] by ijidak on Friday August 25, 2017 @01:57PM (#15100675)
I'm curious what parts you feel are controversial? I don't disagree. I haven't looked it over yet. But sometimes I worry that C# is adding too many features to keep up with what's hot at the moment.

Lambdas vs nested functions is an example that comes to mind (during the Microsoft Build conference presentation of the feature, the presenters jokingly admitted that nested functions arose from Javascript's popularity).

I felt like the value-add of nested functions over lambdas, versus the growth of language complexity, was not great enough to add nested functions as a language feature. (Of course, that's just my opinion.)

But the bigger question is, what's the threshold where software and languages go from being "feature rich" to "bloated"? And are there cases in the past where the corporate stewards of a language have found that sweet spot?

C# has been a great language. I use it every day.

But it feels like the inevitable end game for this language, and maybe every language with corporate stewardship, is that the pressure to release new versions to "keep up with what's hot" eventually ends in the death of the technology by a thousands cuts (where, in this case, by cuts we mean unnecessary features).

(To be fair, the language stewards so far have been batting 900. They've generally done a great job at this so far.)

Re:A Preview of C# 8 [video] by GordonS on Saturday August 26, 2017 @04:06AM (#15104566)
By 'nested functions' do you mean local functions? Another reason for them is that they can sometimes bring performance improvements over lambdas.
Re:A Preview of C# 8 [video] by bpicolo on Friday August 25, 2017 @11:59AM (#15099423)
Feels like extensions tend to make it hard to find out what you need to import to make things work as intended. Maybe visual studio proper is better at inference for it? Will only autocomplete methods that are actually in scope as far as I can tell.
Re:A Preview of C# 8 [video] by wvenable on Friday August 25, 2017 @12:13PM (#15099566)
It will only auto-complete methods that are in scope (the alternative would be a bit crazy) however Visual Studio is smart: if you type in a method you know exists you can press CTRL-. to get it to add the correct using statement to bring that extension method into scope.
Re:A Preview of C# 8 [video] by nickspag on Friday August 25, 2017 @12:36PM (#15099824)
You can turn on an Intelisense option to show methods that would be in scope, if you had the using statement, and it will auto add the using statement if you select that. Really helpful.
Re:A Preview of C# 8 [video] by wvenable on Friday August 25, 2017 @12:59PM (#15100101)
Is this a Resharper thing?
Re:A Preview of C# 8 [video] by jongalloway2 on Friday August 25, 2017 @01:27PM (#15100406)
Yes, it looks like that's "Import Symbol Completion" - https://www.jetbrains.com/resharper/features/code_completion...
Re:A Preview of C# 8 [video] by nickspag on Friday August 25, 2017 @01:45PM (#15100571)
No, but after looking at VS 2017 on my pc and VS for Mac, apparently it's only a feature in VS for Mac- at least from what I could find. I imagine that gets changed soon but yea.

If you use VS for Mac its under Preferences > Text Editor > Intellisense > Show Import Items

Re:A Preview of C# 8 [video] by int_19h on Friday August 25, 2017 @08:30PM (#15103380)
In VS 2017, if you use a method that's an extension method, and don't have the namespace imported, it'll show the auto-correction bulb with an offer to import it.

Better yet, if it's from a NuGet package, it'll offer to install one (or several, if there are multiple candidates).

Re:A Preview of C# 8 [video] by talyian on Friday August 25, 2017 @12:48PM (#15099965)
Compared to say Python, it does act a bit like importing free functions without explicitly naming them, but you do get the bonus of type-based dispatch and overloading.

    using System.Linq;
    foo.Select(x => bar);

    from itertools import *
    imap(foo, lambda x: bar)
Re:A Preview of C# 8 [video] by TimTheTinker on Friday August 25, 2017 @02:18PM (#15100866)
Correct, it can be maddening at times when you want to use LINQ methods but forgot to include System.Linq.
Re:A Preview of C# 8 [video] by apk-d on Friday August 25, 2017 @03:15PM (#15101351)
What helps me cope is that in Visual Studio you can type the extension method's name and ctrl-. to get an "import namespace" quick fix suggestion. It even works when you type it with wrong casing (which happens to me a lot because I'm a really lazy typist). I'm really glad the VS team has been putting more of those in.