4 ms·
So, I know OCaml is impressively fast. And, I know OCaml is impressively terse ("concise" may be a more positive term). But, I wonder what would make one choose
by SwellJoe 10y ago
So, I know OCaml is impressively fast. And, I know OCaml is impressively terse ("concise" may be a more positive term). But, I wonder what would make one choose OCaml (or a variant of it like this) over some of the other new or old languages that exhibit some excellent characteristics for modern systems. In particular, a convincing concurrency story seems mandatory. I don't know enough to know if OCaml (or this variant) has a convincing concurrency story, and nothing on the front page of website tells me.
So, why do I want to learn this, rather than, say, Go or Elixir?
- rixed 10y agoBecause ocaml type system is state of the art unlike go or elixir. Also, what's a convincing concurrency story? Does multiprogramming count?
- ngrilly 10y agoA convincing concurrency story is the one offered by the two languages you mentioned: Go (with memory sharing, which is an advantage or a drawback depending on your goals), and Elixir (no memory sharing between lightweight processes). A version of OCaml offering a similar "concurrency story" would have a lot of appeal.
- rixed 10y agoThose are just techniques, other techniques achieve the same goal, such as multiprogramming, which I think is better that's why I asked. But if you want POSIX threads and lightweight threads for the sake of it, then there are several lightweight threads libraries for ocaml (LWT being the most common one). POSIX threads you have to do from C though.
- morenoh149 10y agoThe ML family of languages have https://en.m.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system https://en.m.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_... which provide many benefits
- fzzzy 10y agoFor concurrency I found this green thread implementation which uses libev or select for io: http://ocsigen.org/lwt/2.5.1/manual/ http://ocsigen.org/lwt/2.5.1/manual/ Also, for parallelism, elsewhere in this thread this link was shared: https://ocaml.io/w/Multicore https://ocaml.io/w/Multicore
- pjmlp 10y agoBecause Elixir doesn't target native code and Go type system is not much better than a safe C with interfaces and packages as addition.
- runT1ME 10y agoOCaml is a much more modern language than Go.
- ngrilly 10y agoYes and no, depending on which aspect of the language you consider: - Type system -> OCaml is more modern (despite being designed before Go) - Concurrency, parallelism, garbage collector, tooling -> Go is more modern (Reason is improving the tooling with refmt for example; work is ongoing on parallelism)
- eru 10y agoInteresting. What's fancy about the Go garbage collector?
- ngrilly 10y agoAs far as I know, there is nothing fancy about it, except for the fact that a lot of work has been put into Go's garbage collector, especially in versions 1.5 and 1.6, with people working full-time on it. Go easily achieves GC latencies well below 10 ms, even for programs using a large heap, without having to manually "tune" the GC. https://blog.golang.org/go15gc https://blog.golang.org/go15gc https://talks.golang.org/2015/go-gc.pdf https://talks.golang.org/2015/go-gc.pdf Go 1.5 concurrent garbage collector pacing, https://docs.google.com/document/d/1wmjrocXIWTr1JxU-3EQBI6BK6KgtiFArkG47XK73xIQ https://docs.google.com/document/d/1wmjrocXIWTr1JxU-3EQBI6BK...