• @[email protected]
    link
    fedilink
    14 months ago

    What does it offer that would make it better? Just curious and I’m not in a position to change out tech stack at work though.

    • @[email protected]
      link
      fedilink
      2
      edit-2
      4 months ago

      The biggest selling point about functional languages for me is the type system, mainly algebraic/union types (which imo Scala does the best), pattern matching (and imo Rust does this best), and the incredible type inference, but also all the functional features. But I think the best part about F# specifically comparing it to C# is the removal of a shit ton of the boilerplate. Plus data is immutable by default, always a nice touch.

      For F#, the special types may not be super relevant when interacting with C# libraries, but in general you can do everything in F# that you can do in C#, including all the OOP. It’s just an added bonus that you basically get enums on steroids and pattern matching.

      I find that writing in F#, even if I write basically the same code I would in C#, speeds up my design/programming a TON and makes it significantly more maintainable and easy to navigate. There’s a lot less clutter and you don’t have to worry about the layers upon layers of repetitive boilerplate.

      The only downside IMO is that F# can have some terrible error messages. And of course, you have to learn F# syntax which can be a small pain if you’ve never used ML or Haskell (especially when it comes to function call syntax). But if you’re mainly interfacing with C# libraries then it’s no big deal. I started making an application only utilising C# libraries (mainly DB stuff) the same day I started using F# and it went relatively smoothly, although probably because Rust is the main language I used then.

      This resource might help, although I can’t say it’s enough to completely learn the language: https://fsharp.org/learn/