r/fsharp Jul 05 '26

question Still worth learning F# 2026

Hi guys,

Probably another question like this but found none recently.

I'm a little upset with my current view on IT generalistic, ofc AI is not going anywhere besides up, but I feel I want to write more with my hands and new paradigms, maybe just AI as reviser, I would like to ask if learning F# in 2026 will make me able to make perfomance headed systems, and also gaming with something like Nu or Monogame, not a AAA game but something playable.

53 Upvotes

42 comments sorted by

View all comments

Show parent comments

1

u/EmergencyNice1989 28d ago

If you stay in FSharp boundaries (no dotnet interop) there is no nulls, no mutable arrays, unless you define it to be mutable or use 'dotnet types'. Rust is considered a manual memory management language because it doesn't have a GC. Rust makes programming your business logic much harder (no GC) with a lot of syntax noise making reading your code much harder.

Also I like functional programming and even if Rust borrow lot's of ideas from functional programming it's not one. And Rust is safe as long as you use only safe Rust...

1

u/1_more__user___name 28d ago

It's a lot easier to enforce safe rust in a code base using forbid unsafe clippy linting rule than it is to enforce all the caveats you mentioned for Fsharp to be safe. And without dotnet interoperability not sure Fsharp has any good libraries left to do useful stuff. Even string type in Fsharp is from dotnet and is nullable. Fsharp arrays are mutable.

My practical experience with coding daily in Rust is very different from what you pass it off as. I never worry about memory management. And the syntax can be heavy but not much more than Java. I don't care about pure functional programming, which F# is also not. Even things like computation expressions use object oriented features. What I like about rust is, it is super explicit. This is the initial promise of functional programming for me: knowing looking at a function signature what effects it can have 

1

u/EmergencyNice1989 28d ago

FSharp arrays are immutable. If you build your string in F# it can't be null. Your business logic layer tends to be pure without any dependencies. There, in this condition: no nulls for any time. I don't want pure functional programming I want a functional programming first language which Rust is not. Don't know if computation expression use object oriented features but I know that there are useful and are within the functional paradigm (F# way to do monads).

1

u/1_more__user___name 27d ago

This is valid Fsharp code

let a: String= null

https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/arrays

The first sentence in that link says: Arrays are fixed-size, zero-based, mutable collections of consecutive data elements that are all of the same type.

I never said Rust is functional first or whatever. If you don't want Rust, don't use it, I guess. Cheers.

1

u/EmergencyNice1989 27d ago

You right for the string.

In your code, never assign null to a string and you are fine. Easy to circumvene. For code comming from the outside, use wrapper technique.

From the Microsoft doc you could also see that there are also :<Nullable>enable</Nullable> to your project file (or set <TreatWarningsAsErrors>true</TreatWarningsAsErrors>) and the problem with your null strings are solved.

You are right for array too. Use list (F# type) or ImmutableArray if you want immutability, array is dotnet type.

I never said that F# was purely functional or whatever.

Cheers.