Are there any benefits besides the obvious 'write-once, run-anywhere' one?
EDIT: I just want to be clear that I don't have any negative opinion of F#, I am genuinely curious why someone would want to use this on a platform that is not Windows.
Are there any benefits besides the obvious 'write-once, run-anywhere' one?
EDIT: I just want to be clear that I don't have any negative opinion of F#, I am genuinely curious why someone would want to use this on a platform that is not Windows.
1. You have much richer libraries available. There's a
decent amount of stuff in OPAM these days, but that's
dwarfed by what you can grab out of NuGet.
2. You have a great asynchronous/multithreading story. The F# async
workflow makes it trivial to write multithreaded apps in
a similar way to C#'s async/await calls (in fact, F# is
the origin of that design), and it performs very well.
OCaml still doesn't do very well with multithreaded
programs.
You also lose some things, two of which that are most poignant to me: 1. OCaml is faster than F# for single-threaded programs.
This has nothing to do with Mono's maturity or speed as
such, but does have to do with its garbage collector,
which has not historically dealt well with F#'s allocation
patterns. I have not taken time since SGen landed to
revisit that, though, so the situation might be much
better.
2. OCaml can produce tiny self-contained binaries. Mono's
AOT gets you the self-contained easily, but you'll be
looking at relatively large executables.1) Familiarity, if you already know the language, tooling and libraries then you might be better off sticking F# than learning OCaml.
2) Size of community. I'm willing to be proved wrong here, but I find it alot easier to get an F# question, and often more importantly, a question about a library I'm using when I write F# than when I write OCaml.
3) Libraries, Libraries, libraries...
Also the mono runtime is pretty darn good. I agree its not as tuned to handle the small object and lifetimes that functional languages generate but I'm not really running into that limit currently.
With standard library I mean int/float/string/IO/http/xml/async/etc not speaking about stacks of .net (like ui with wpf).
Standard library work really good cross platform with mono, share documentation/stackoverflow with .NET. Mono team fix fast bug when behaviour differ from .NET
Instead of use complex stack like wcf (to create service, partially implemented on mono, webservice ok, soap WS-* less) but bundled with .NET, you can use open source libraries (like nancy, servicestack), change serialization library, etc.
F# use .NET standard library (same library/dll, so a c# answer about StringBuilder class is the same from c# and f#). Can also use every .NET library, bundled with mono/.NET or third party.
+ runtime
+ core = standard library, io/string/async/thread/etc/linq.
+ some bundled stack, like wcf for create service, wpf for ui, mef for plugin, xml serialization, json serialization, asp.net webforms, etc.
Mono try to reimplement all. Runtime and standard library work very well on mono.
bundled stacks can work, work partially or not implemented, depends (on contribution, check mono website). Some stack are really old way to do things, deprecated, usefull only on windows. Also Microsoft for new stacks (like asp.net MVC) try to open source, so mono need to compile source and fix bug/different behaviour, not rewrite
If you use a library who depends on a bundled stack, can or cannot work on mono. Library who depends on open source or standard lib, should work
And obviously you can't use SQL Server or IIS; two components usually used in .Net applications; under unix
Xamarind is a drop in the sea of .NET