News for hackers. Stuff that matters.
Re:C# functional language extensions and Erlang-like concurr... by ZeroClickOk on Sunday January 29, 2017 @01:49PM (#13515847)
Tuples will be native first class citizen on C# 7 (https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new...)
Re:C# functional language extensions and Erlang-like concurr... by louthy on Monday January 30, 2017 @05:47PM (#13525831)
Author here. When I started the project C#6 was just arriving. It's awesome to see the ValueTuples coming through for C#7. I have been adding some super-powers to them for lang-ext 2.0 (which is work in progress):

Example of extensions for ValueTuple<A,B,C> (there are extensions up to ValueTuple<A,B,C,D,E,F,G> and Tuple<A,B,C,D,E,F,G>)

https://github.com/louthy/language-ext/blob/type-classes/Lan...

It allows cool stuff like this:

    var abc = ('a', 'b').Add('c');                                           // ('a', 'b', 'c')
    var abcd = ('a', 'b').Add('c').Add('d');                                 // ('a', 'b', 'c', 'd')
    var abcd5 = ('a', 'b').Add('c').Add('d').Add(5);                         // ('a', 'b', 'c', 'd', 5)

    var sumA = (1, 2, 3).Sum<TInt, int>();                                   // 6
    var sumB = (2, 4, 8).Product<TInt, int>();                               // 64
    var flag = ("one", "two", "three").Contains<TString, string>("one");     // true
    var str = ("Hello", " ", "World").Concat<TString, string>();             // "Hello World"
    var list = (List(1, 2, 3), List(4, 5, 6)).Concat<TLst<int>, Lst<int>>(); // [1,2,3,4,5,6]
Re:C# functional language extensions and Erlang-like concurr... by hurricaneSlider on Sunday January 29, 2017 @02:28PM (#13516052)
I've been using them quite heavily already. Lovely stuff. Though disappointing that record types didn't make it in.
Re:C# functional language extensions and Erlang-like concurr... by dualogy on Sunday January 29, 2017 @02:52PM (#13516199)
Doing Haskell nowadays, been years since touching C# --- maybe my memory is fooling me but didn't have C# "structs" (or whatever they were called) from the very start? What else exactly are "record types" if not those?

Or do you simply mean some leaner syntactic sugar for their on-the-fly instantiation?

Re:C# functional language extensions and Erlang-like concurr... by rubber_duck on Sunday January 29, 2017 @03:15PM (#13516319)
Structs are mutable value types. Record types would let you define objects with public getters only and constructor that assigns them and a fancy syntax for creating a new object based on an existing record value + new property values, I think something like

    Point a = b with {X = 0} 
this will make using immutable record types in C# much less tedious. Will also implement other stuff like value equality override, etc. I wish this was in 7.0, this is a great way to do FP in C# when you can't use F#.

Proposal link : https://github.com/dotnet/roslyn/blob/features/records/docs/...

Re:C# functional language extensions and Erlang-like concurr... by hurricaneSlider on Sunday January 29, 2017 @03:03PM (#13516248)
Yip syntactic sugar for immutable property only class instantiation.

Structs differ from classes in that they are guaranteed to be contiguously placed laid out in memory; they're also non nullable and can't be a part of the inheritance hierarchy (though they can implement interfaces, which have some perf tradeoffs).

Re:C# functional language extensions and Erlang-like concurr... by christophilus on Sunday January 29, 2017 @10:49PM (#13518494)
I'm curious how you made that transition,and what problem domain you're in. I predominantly write web applications. Lots of React, but some traditional MVC apps,too. Haskell is a language I want to love, but haven't ever managed to find it productive in my problem space.
Re:C# functional language extensions and Erlang-like concurr... by dualogy on Monday January 30, 2017 @07:39PM (#13526443)
Haven't done it all that long, after C# I first went Go for a few years, and spent much time with GL shaders and such too.

Haven't done such "real-world" stuff (with a proper server side, client side, data side etc) in Haskell either --- yet. It's not immediately productivity-inducing at all. I think over the very long haul, prolonged intensive exposure makes many a developer of "mainstream/web/crud/mvp/etc extractions" a much more rigorous, precise, exacting practitioner, which will yield a hard-to-quantify, harder-to-capitalize-on, but still very real and more substantive/deeper/sustained "productivity boost". It also teaches one to think of more robust patterns of abstraction and generalization which can translate back into programming-in-other-languages.

Nothing more tangible than that to report. Also there's a lot of curious-researcher-type "playfulness" in the wider ecosystem that's very tricky to assess what this will actually buy the "let's get coding" "brogrammer" (such as I)!

One facet that makes it quite worthwhile is that the language/compiler/ecosystem has incredibly bright people contributing not just by devising yet another funky undecipherable combinator for saving 10 lines of code in once-a-decade scenarios, but in fact actual hardcore pedal-to-the-metal under-the-hood optimizations, code check/test/validation assistence tools, keeping it all somewhat performant in server/parallel/concurrent scenarios and so on.