News for hackers. Stuff that matters.
Re:F# is gaining independence from .NET by xupybd on Monday February 01, 2021 @03:10AM (#25986617)
The functional hammer can be a little easier to reason about. So you can understand your application a little more.
Re:F# is gaining independence from .NET by dleslie on Monday February 01, 2021 @03:20AM (#25986670)
It's possible to write functional C# code, as well.
Re:F# is gaining independence from .NET by paavohtl on Monday February 01, 2021 @04:42AM (#25987164)
Ehh, 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.

Re:F# is gaining independence from .NET by dleslie on Monday February 01, 2021 @10:36AM (#25989551)
That stinks of microallocations from enormous stacks of closures, boxing and similar.
Re:F# is gaining independence from .NET by xupybd on Monday February 01, 2021 @03:46AM (#25986814)
Yeah 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#.

Re:F# is gaining independence from .NET by pharmakom on Monday February 01, 2021 @03:29AM (#25986715)
It’s possible but it’s just not the same.