4 ms·
I've loved using OCaml on some toy problems. OCaml (and so probably F#) feel suitable for anything you'd use Golang for (performance is similar; code can be ter
by jongraehl 13y ago
I've loved using OCaml on some toy problems. OCaml (and so probably F#) feel suitable for anything you'd use Golang for (performance is similar; code can be terser due to typing-saving language features), except if you must have threads for concurrency.
- mjt0229 13y agoAre other forms of concurrency still available? This has always seemed like a strange limitation. Most of the code that I write doesn't require me to spin up tons of threads (at least, not in my code), but sometimes it's really helpful to have them.
- edwintorok 13y agoYes: * multiple processes (there are a few libraries that can help make it easier) * I/O concurrency with cooperative threads library: Equeue, Lwt or Async * you could also use the built-in Thread module for I/O concurrency but the overhead will likely be higher * you can execute C code in multiple threads in parallel, only OCaml code is limited to a single thread (due to the global lock)
- emmelaich 13y agoWhat are those libraries for multiple processes under Ocaml? I could google but I'm fishing for your recommendations as well.
- edwintorok 13y agoFunctory, OCamlMPI and Netmulticore (part of OCamlNet). I haven't actually used any of them though, I'm quite happy with Lwt for now.
- pjmlp 13y agoF# has all the threading power of the .NET runtime at its disposal, including asynchronous programming and the TPL. OCaml global lock on the INRIA implementation might eventually be fixed. Both are pretty good alternatives to Go if you are more into FP and modern language abstractions.