6 ms·
It's a real shame, but not unexpected. The vast majority of programmers I meet in the wild simply do not have training in FP and by the time they decide to lear
by hvidgaard 6y ago
It's a real shame, but not unexpected. The vast majority of programmers I meet in the wild simply do not have training in FP and by the time they decide to learn it (if they do), it's hard to unlearn "traditional" thinking.
If we want to steer programming in that direction, we should teach functional programming before "traditional" programming. However, even if we manage to do that I'm not convinced that it will make a different. People think procedural and it seems that the abstraction of first order functions is hard.
- catmanjan 6y agoAs a .NET developer I don't see any reason to use F# professionally. C#/CPP are tools just like a hammer, F# is a different hammer, it doesn't seem to offer advantages in my field other than being different...
- xupybd 6y agoThe functional hammer can be a little easier to reason about. So you can understand your application a little more.
- dleslie 6y agoIt's possible to write functional C# code, as well.
- pharmakom 6y agoIt’s possible but it’s just not the same.
- xupybd 6y agoYeah you can. I find it a little more clunky. Many of the things I prefer are just syntactic sugar. But if I'm honest I really like syntactic sugar. On top of that I find functional first languages are great for forcing you to learn functional styles that you can later user in languages like C#. C# is a brilliant language and I wouldn't knock it. I'd use that as a first option at work but on a hobby project I'm going to play with F#.
- paavohtl 6y agoEhh, not really. It depends on how you define functional programming. C# supports first class functions, tuples, some form of pattern matching and LINQ extensions support basic FP collection operations like map (Select), filter (Where) and fold (Aggregate). But I think that's just scratching the surface compared to a "real" FP language: - F# has function composition operators - F# functions are curried and support automatic partial application - F# variables and data structures are immutable by default - F# has powerful global HM type inference - F# uses option & result monads over exceptions and null - F# has algebraic data types with exhaustiveness checking These capabilities make writing code in F# a very different experience from C#. Some of these can be added to C# as features, but many things are fundamental parts of language design that are hard to change afterwards.
- dleslie 6y agoThat stinks of microallocations from enormous stacks of closures, boxing and similar.
- freeone3000 6y agoIt allows you to envision your application as a series of data transforms, instead of a list of steps. This allows much more proximal abstractions for tasks involving data manipulation.
- dleslie 6y agoYou can treat your application as a series of data transforms with C#, as well.
- freeone3000 6y agoIt's.. not as nice. LINQ gets halfway, but, you end up getting back to procedural modeling soon. With sufficient discipline and structure, and liberal use of LINQ and lambdas, you can mostly get there, but it lacks the purity of pure functional.
- dleslie 6y agoAnd in the process you've incurred a devastating amount of micro-allocations. When using Unity with an older version that doesn't have incremental GC this is a serious problem. Does F# avoid that?
- freeone3000 6y agoOh, god no. Performance even on fairly trivial number crunching tasks is half of C#, nevermind anything where GC is important or you'd consider writing it native. It's not a performant language, that's not the point.
- moonchild 6y agoThat's not a fundamental limitation, though. Implementations of SML (f# is effectively an ML implementation), OCaml, and Haskell are all quite performant.
- sfg 6y agohttps://ericsink.com/entries/fsharp_chasm.html https://ericsink.com/entries/fsharp_chasm.html
- andi999 6y agoI think one problem is (was?) winforms is not available in f#. (which is c# unique selling point i. m. h. o.)
- beyon 6y agoAre you thinking of something else than winforms? I believe winforms and WPF has always been usable but not with the visual designer tooling in visual studio. UWP has been trickier though to my knowledge.
- andi999 6y agoI probaby meant the visual designer tooling. (Which is a big point in using Visual studio)
- dleslie 6y agoI'm a long-time Emacs user, Scheme fan, functional programming advocate ... Who uses C# in his day job. For quite a long time F# simply wasn't ready, and by the time it was C# had already become an industry behemoth. But more critically, it's not a language that's officially supported by Unity. That's enough for it not to be a wise choice to be betting a project on it where there are dozens of jobs on the line, and families that could be impacted. I can't help but think that this concern isn't simply isolated to Unity software development; where else has the decision been made to not use F# on account of it not enjoying as much industry support as C#?
- dmitriid 6y agoI've done FP (several years of Erlang), and I use FP daily in my work (since most languages support FP to varying degrees). I see no point in F# other than "well, it's a nice-ish ML for .NET", and the article does nothing to help with that (file order? really? that's what you're going for as the first point to make about a language?) .
- KurtMueller 6y agoWell, now it's also a "nice-ish ML" for javascript, thanks to Fable.