15 ms·
A Brief F# Exploration
- ollran 6y agoOCaml would meet all the requirements. Any thoughts on it?
- swuecho 6y agoocaml ecosystem is smaller than haskell. ocaml kind of meets the minimal requirement, but far away from production grade. in frontend, bucklescript changes too quickly. js of ocaml is hard to use. good luck if you want to trim the code size.
- pjerem 6y agoThe most impressive feature of F# clearly is its tight integration to dotnet/C#. It’s super easy to mix C# and F# code in the same project and it works out of the box. This allows you, if you want it, to write your domain code in F# and your technical code in C#.
- LandR 6y agoDo you mean same solution? I didn't think you can mix languages over the same project in C# / F#
- pjerem 6y agoYes, same solution, my bad.
- pjmlp 6y agoOnly on regular .NET, the UWP story is a bit different.
- tigershark 6y agoThere are a lot of places where interop sucks. Other than the ones already mentioned by someone else in a previous comment there are the events that need a lot of ceremony in F# to be compatible with C#, lack of implicit conversion that in some cases renders some C# libraries unusable unless you define some explicit conversion operator and probably some other stuff that now I don’t remember. If you can work only in F# it’s a much better experience compared to mixing C# and F#.
- pharmakom 6y agoOCaml type system is more powerful than F#. OCaml lacks operator overload, computation expressions (unless you use an extension?) and threading (coming soon?). The community is tiny for OCaml. F# is small too but it can access all of .Net easily and there are some good IDE options. F# is backed by Microsoft. F# is low risk to adopt compared to OCaml. F# is the functional language pick that won’t get you fired.
- aloisdg 6y agoAnd if you already are a .net shop, adding some F# code in a dependence is really smooth.
- louthy 6y agoThat is until Microsoft release a version of the Framework or a version of VS that breaks F# in your project. I dropped F# support from my one of open-source projects because of this, and at my company we've decided to stop all future F# development. The move to .NET Core was an absolute clusterfuck for F# ... well, it was for C# too, but everything broke in the F# world ... I even ended up on a Skype call with the PM of the F# team as he tried to help resolve my issues; it's amazing he was willing to help, but it was kind of indicative of a bigger issue (I believe). The tooling is poor in general, the interop is questionable at best. One example is `Option a` in F# becomes `FSharpOption<A>` in C#, with `None` being `null` - breaking all of the type-safety of the union-type. It isn't seamless in the way some might have you believe. The standard answer is build a wrapper to expose F# to C#, which is ok, but is an extra level of indirection and complexity that shouldn't be needed (if indeed the idea is to have seamless interop). I developed language-ext [1] to bridge the divide, but in the end there isn't a strong enough reason to write F# all the time in the .NET sphere. It is compromised by an ecosystem where C# is dominant. That includes the framework libraries and even the limitations of the type-system in F# (no higher kinds for example). There's no real reason for F#, other than a nicer syntax, it doesn't have a killer USP like Haskell (purity) or Erlang (concurrency). If it wasn't in C#'s shadow, and it was able to run free, and without compromise, there could be a compelling narrative - but what we're doing now is moving to PureScript for our front-end, and Haskell for microservices where we need the USP of Haskell (purity and strict domain modelling). [1] https://github.com/louthy/language-ext/ https://github.com/louthy/language-ext/
- auxym 6y agoOCaml has subpar windows support. The native version is experimental, otherwise it's cygwin or WSL.
- nestorD 6y agoI personnaly went from Ocaml to F# because it had much better tooling (IDE support) and a larger libraries ecosystem (access to all .Net libraries).
- aranchelk 6y ago> Must run natively on backend without nodeJS (rules out the likes of PureScript) PureScript does have an Erlang backend as well. My understanding is F# relies on a JIT just as Node (V8) does. Are either really native? Are both?
- pharmakom 6y agoF# can run in a few different places: .Net, node, browsers, .Net core, Mono and AOT compiled. Some targets have JIT, some do not.
- tremon 6y agoYes, F# relies on a JIT, but not just as Node does. F# compiles to CIL, the .Net runtime bytecode format. It is much more like Python bytecode (pyc) or JVM bytecode (jar) than like Javascript. FAFAIK Node doesn't compile to an intermediate language, it either compiles to minimzed (lets-just-remove-all-whitespace) Javascript, or it generates a native binary.
- michaelcampbell 6y ago.class for java; .jar is just a zip file with some metadata.
- Kipters 6y agoIt does, but you can produce self-contained applications that don't need the runtime to be installed (it's included in a native binary shipped with the application). Full AOT compilation is also being worked on.
- skrebbel 6y agoI'm assuming that they primarily mean "I prefer not to depend on NodeJS for $REASONS". That's pretty fair, Node is amazing but there's definitely also plenty to dislike.
- angio 6y agoMy favourite thing about F#/.NET Core (I guess .NET 5 now) on Linux is how easy it is to install multiple versions side by side using my distro package manager. This spoiled me so much now I'm disappointed when I have to use conda/rustup/etc.
- xfer 6y agoConsider using nix package manager. You can have multiple versions for every tool/library you like.
- de_keyboard 6y agoNix looks great, but you have to go all in on Nix. Sometimes it's simpler to install a few tools locally but not control the entire environment.
- CloselyChunky 6y agoYou can install nix side by side to your distro package manager and only install some packages using nix. You could also use something like lorri and direnv and let nix only manage your code projects and when entering the project directory, drop you into a shell with only the dependencies you need for this specific project installed.
- swiley 6y agoguix is similar but can be used on OSes with a traditional package manager. I personally prefer it.
- mixedCase 6y agoYour usecase is what nix-shell is for. It loads an environment on top of yours for just a single project.
- bromanko 6y agoI agree with the author about the slow inner loop experience. Recompiling the whole app to see browser changes gets tiring. The .NET team is planning a series of updates to address this in .NET 6. https://github.com/dotnet/core/issues/5510 https://github.com/dotnet/core/issues/5510 I also dislike the default workflow for dealing with Nuget forks. I switched to Paket for dependency management which makes this much simpler. https://fsprojects.github.io/Paket/ https://fsprojects.github.io/Paket/
- tasogare 6y agoThis is a very strange criticism given that F# was the first language to have a REPL and nowadays most web projects also have a compilation step.
- FPGAhacker 6y agoDo you mean The first dotnet language?
- tasogare 6y agoYes of course, I forgot that word.
- pjmlp 6y agoActually no, because on the release CD of Common Language Runtime, and the alphas and betas that preceded it, Microsoft collaborated with several companies and universities to have various languages available at lunch date. Many of which did have a REPL. Also the dynamic language runtime originally designed for Iron languages, Python and Ruby, precedes F#.
- sandyarmstrong 6y ago> The .NET team is planning a series of updates to address this in .NET 6. This is already bearing fruit in the latest preview: https://devblogs.microsoft.com/dotnet/announcing-net-6-preview-3/#tools-initial-net-hot-reload-support-now-available-for-web-apps https://devblogs.microsoft.com/dotnet/announcing-net-6-previ... I also saw this lovely update for Xamarin.Forms users https://twitter.com/drasticactionSA/status/1380262682872442890 https://twitter.com/drasticactionSA/status/13802626828724428...
- christophilus 6y agoF# is a great language. I just wish it compiled as fast as OCaml or even anywhere near as fast. I also wish it produced a single static binary, though I guess this is now possible in .NET? It’s been a while since I toyed with it.
- JohnCurran 6y agoYou can produce a single file binary, with the caveat it includes the entire .NET runtime, which leads to massive build artifacts. Though it is better than no support at all I suppose
- pjmlp 6y agoThat is no different than in languages like D or Go, the runtime comes along.