News for hackers. Stuff that matters.
Re:Show HN: C# 6.0 Functional Language Extensions by martijn_himself on Wednesday November 19, 2014 @02:30PM (#8632092)
This is a really interesting experiment, although personally I'd find using:

var ab = tuple("a","b");

awful. It's very hard to read what is going on here- someone else reading your code would be utterly confused. The method name starts with a lowercase character, and I'm not sure I like the possibility to omit class names for static classes (granted this is not your invention but a new C# feature right?); to me it would seem it is missing the 'new' keyword.

I'd rather use Tuple.Create<T1,T2>(T1 first, T2 second) until they add proper support for:

var ab = ("a","b");

Re:Show HN: C# 6.0 Functional Language Extensions by louthy on Wednesday November 19, 2014 @02:36PM (#8632121)
That's fair enough. I knew implementing it this way would ruffle a few feathers, and I totally understand why. I too would love to see ("a","b"), and proper pattern matching... and ..

This was a weekend project that kind of grew over the past few days. Initially I wasn't going to make everything lowercase, but I started thinking about the fact that a lot of these functions are now essentially global and the potential for clashes in real code. So I felt having a core set of useful functions that look more like the lowercase keywords of C# rather than library methods would work better. It definitely won't be everybody's cup of tea though.

Re:Show HN: C# 6.0 Functional Language Extensions by martijn_himself on Wednesday November 19, 2014 @02:46PM (#8632173)
I realise my comment is probably a bit too negative- I really like your ideas (especially the Option type). Things like Tuple<T1,T2,T3> etc. make me wonder if we would not all be better off though if we just started using F#... although I still like C#.
Re:Show HN: C# 6.0 Functional Language Extensions by louthy on Wednesday November 19, 2014 @05:11PM (#8632994)
> I realise my comment is probably a bit too negative

Not at all, you're entitled to your opinion. Whatever works for you :)

> we would not all be better off though if we just started using F#... although I still like C#

That would be nice. Unfortunately it's not always quite as easy as that. At least in my corner of the world!

Re:Show HN: C# 6.0 Functional Language Extensions by MichaelGG on Wednesday November 19, 2014 @08:54PM (#8633969)
The first time you might go wonder what the function "tuple" is, and after that you're set. It looks vastly better than the verbose "Tuple.Create" call. Less characters, same information.

Top level functions were sorely missing from C#, so it's nice they addressed it. You're right though, we'd all be better off using F#. But there is a ton of unjustified people not wanting to use it, as well as fear from people incapable of doing so. Might as well make the best of C#.