3 ms·
Downsides: lack of jobs, libraries, learning materials, small community, little promotion by Microsoft outside of "what's new in F#" and other announcements. I
by modernerd 2y ago
Downsides: lack of jobs, libraries, learning materials, small community, little promotion by Microsoft outside of "what's new in F#" and other announcements.
It's a shame because F# is a beautiful language — it's fun to read, write and maintain. .NET now works well cross-platform with editors other than Visual Studio. General perks of .NET like cross-platform compilation are a nice bonus, for example, on macOS I can:
brew install dotnet
dotnet new console -lang F# -o HelloWorldApp
cd HelloWorldApp
dotnet publish -c Release -r osx-arm64 --self-contained
dotnet publish -c Release -r osx-x64 --self-contained
dotnet publish -c Release -r win-x64 --self-contained
dotnet publish -c Release -r linux-x64 --self-contained
To get self-contained binaries (that don't need .NET to be installed locally) for those platforms.
There is a decent multi-platform UI framework called Avalonia: https://github.com/fsprojects/Avalonia.FuncUI https://github.com/fsprojects/Avalonia.FuncUI
There are good actively maintained web frameworks: https://fsharp.org/guides/web/#web-frameworks https://fsharp.org/guides/web/#web-frameworks
There are some passionate people writing great books about F#: https://fsharpforfunandprofit.com/ddd/ https://fsharpforfunandprofit.com/ddd/
Most of F#'s adoption issues seem to be because:
1. It's tough to convince people outside of the .NET community to use .NET.
2. Most of the people using .NET use C#.
3. It's hard to convince C# users to adopt F#. (See https://www.reddit.com/r/dotnet/comments/16m0wdj/why_dont_you_just_use_f/ https://www.reddit.com/r/dotnet/comments/16m0wdj/why_dont_yo... and similar threads.)
I'd love to work with F# full-time, but — short of starting my own company using it or convincing Microsoft to pay me to help them showcase its benefits — it's been hard to find work with F#, which drove me to spend time with other languages.
- neonsunset 2y agoF# can also be compiled with NativeAOT. The main thing this target complains about is printfn and especially printfn "%A" which uses unbound reflection. So as long as you just Console.WriteLine instead it may not emit warnings: dotnet publish -o {folder} -p:PublishAot=true Note that -c Release is no longer required - it is now a default for 'publish'. Also, if you are doing a self-contained/non-AOT build, you may want to do it as follows to retain compact binary size: dotnet publish -o {folder} -p:PublishSingleFile=true -p:PublishTrimmed=true All the properties above can also be defined within respective .csproj/.fsproj files inside PropertyGroup blocks as e.g. <PublishAot>true</PublishAot> so you don't have to add them to a command every time. F# also has excellent support for scripting with fsi and .fsx format: https://learn.microsoft.com/en-us/dotnet/fsharp/tools/fsharp-interactive/ https://learn.microsoft.com/en-us/dotnet/fsharp/tools/fsharp... Someone even made a tool for it which builds on top of bflat allowing to compile F# script files into native binaries directly without project setup: https://github.com/ieviev/fflat https://github.com/ieviev/fflat
- modernerd 2y agoThanks for the tips! I had thought there were still some other gotchas with AOT and F# but it looks like the list is smaller than last time I looked. https://github.com/dotnet/fsharp/issues/13398 https://github.com/dotnet/fsharp/issues/13398