News for hackers. Stuff that matters.
Re:OCaml for the Masses (2011) by zengid on Monday November 26, 2018 @07:25AM (#18532803)
Not trying to contradict you, but I think C# is special in than it has absorbed a lot of things from the academic functional programming world and presented them in a nice 'friendly' form for the masses; IE, LINQ; first class functions like delegates and Func<> and Action<>; and now tuples and pattern matching in C# 7 (among many other things).

I know having mutability the default still lets one shoot themselves in the foot (and nullable reference types), but I'm always impressed when I find more of the nice FP ideas baked into the language. It's a pretty good compromise for me.

Re:OCaml for the Masses (2011) by bad_user on Monday November 26, 2018 @07:36AM (#18532864)
Functions in C# aren't really first class. A static method for example isn't a Func< > or an Action< > and neither are normal methods, both of which are prevalent. To say that C# has first class functions is a misnomer.

And on anonymous methods (delegates), Func< > and Action< >, that there's even a difference between the 3 shows C#'s age and some of its quirks.

> now tuples and pattern matching in C# 7

Note the pattern matching in C# is a far cry from what you get normally in FP languages. First of all C# does not have ADTs, which means it cannot do exhaustiveness checking, making pattern matching only a superficial syntactic sugar.

Tuples are nice though.

> academic functional programming world and presented them in a nice 'friendly' form

This is sort of a marketing myth. C# is not an FP language and I rarely see actual FP built in C# (same goes for Java).

In my opinion you should try out the languages in the "academic functional programming world". Because you'll then notice that C#'s way of doing things is not "friendly", unless by that you mean half baked and annoying ;-)

Re:OCaml for the Masses (2011) by zengid on Monday November 26, 2018 @07:39AM (#18532882)
I totally agree that FP in C# isn't super nice (its clear that it's bolted on) but to match the style of my co-workers, I can't do much more than sneak in a few little things here or there. The bulk of the code is clearly OOP, and I've accepted that, but at least I can have a little fun with some LINQ and a few extra vars that I don't mutate. :)
Re:OCaml for the Masses (2011) by bad_user on Monday November 26, 2018 @09:06AM (#18533402)
True :-)
Re:OCaml for the Masses (2011) by Bizarro on Monday November 26, 2018 @11:07AM (#18534276)
FP is a style of programming and not a language. You can write imperative code in Haskell.
Re:OCaml for the Masses (2011) by jasim on Monday November 26, 2018 @07:31AM (#18532835)
My cursory experience with C# was very pleasant too, and Erik Meijer managed to put in some monads into the language thru LINQ when no one was looking (https://queue.acm.org/detail.cfm?id=2024658)

Java 8 was a joy to work with as well - FP is filtering down through lambdas and map, filter, fold et al.

Re:OCaml for the Masses (2011) by markdoubleyou on Monday November 26, 2018 @01:37PM (#18535684)
Great article, thank you for sharing!