5 ms·
Can't wait for tinkering with OCaml when 5.0 is stable. Pretty sure the community will invent amazing libraries for parallel computation as well. Maybe finally
by pdimitar 4y ago
Can't wait for tinkering with OCaml when 5.0 is stable. Pretty sure the community will invent amazing libraries for parallel computation as well.
Maybe finally Rust+tokio projects will have some actual competition!
- _flux 4y agoOCaml is possibly my favorite language, along with Rust, and what I hope from the Santa is projects like https://github.com/tezedge/ocaml-interop https://github.com/tezedge/ocaml-interop to become mature. I think all these "properly typed" languages should aspire to have great interoperability: after all, they have types to help. But I realize there can be big technical difficulties in making it safe, in particular with garbage collection..
- CodeSgt 4y agoHow does it compare to Rust? What do you like about each?
- ChadNauseam 4y agoThe garbage collector is nice because sometimes you don't want to think about memory management or the borrow checker. The syntax is really cool, it looks like python but it's completely whitespace insensitive. The module system is neat, and I actually like writing module interfaces (which are basically analogous to header files in C/C++). It makes dependency injection trivial, because you can have a module say "I depend on a module with this interface, but the caller can choose which one", which is more useful than it sounds. It's also a functional language, so you have very little mutability, and it supports """monads""" with its super innovative "monadic let" syntax. (It's basically like overloading the semicolon, which probably doesn't make any sense, but it's really cool.) Dune is a very pleasant build system and Esy is a very pleasant package manager. The language server is good. I'd say in this dimension it's competitive with Rust. There's really quite a lot to like about OCaml. My biggest gripe with it is no typeclasses/traits. But I have hope that modular implicits will land within our lifetimes.
- tgflynn 4y agoWhat exactly is Esy ? I hadn't heard of it before and its website doesn't seem to provide an obvious answer to that question. You say it is a package manager. Is it supposed to replace opam ? If so what does it offer that opam doesn't ?
- pdimitar 4y agoIt's like Rust's cargo or Elixir's mix. A task runner, mostly.
- ChadNauseam 4y agoIt's a package manager that replaces Opam. It doesn't require switches and it caches builds of packages across projects.
- UncleOxidant 4y ago> The syntax is really cool, it looks like python I'm squinting really hard but not seeing the resemblance.
- ChadNauseam 4y agoI said that because there's no curly braces and you don't usually have to use semicolons
- throwamon 4y ago> you don't usually have to use semicolons That's compensated by the use of double semicolons :O)
- ChadNauseam 4y agoHa! That's only in the REPL, which I never use
- anentropic 4y agoI'm a bit confused... the readme of ocaml-interop says it's "inspired by" ocaml-rs while ocaml-rs says it "uses ocaml-interop behind the scenes" and "also exports an interop module, which is an alias for ocaml_interop and the two interfaces can be combined if desired" from a cursory look over ocaml-rs seems possibly the one to use, as the more comprehensive project
- gadmm 4y agoThe development of the OCaml-Rust interface is a bit organic. `ocaml-interop` aims to be a low-level but safe interface. At Inria we worked with the author to integrate ideas about using Rust's type system to safely work with a GC. We have more ideas to make it better; if someone wants to commit engineering time in this area they should feel encouraged to contact me.
- wyager 4y agoAn ML that competes with rust+tokio is an exact description of haskell. It's had the best multicore runtime and concurrency primitives of any general purpose language for quite some time. No need to wait.
- pdimitar 4y agoIncluding work-stealing scheduler and runtime? Ability to just spawn 50_000 tasks -- regardless of whether they're CPU-intensive or I/O bound -- and have the runtime handle it speedily? I've heard Haskell praise a good amount of times but at the same time many people also said that doing actual work with it has more friction than it should, so I don't know.
- shirogane86x 4y agoI don't know if those things you ask are in Haskell specifically, but what I do know is that Haskell concurrency is pretty much best in class. You get channels (Control.Concurrent.Chan is in the stdlib), STM, green threads (forkIO). You can also get stuff like async (from the async library) or streamly (even higher level than traditional async). I'm not 100% sure if you can push insane speeds with it (even though Haskell is really fast, it's just very tricky to optimize correctly) like you can with Rust, but the developer experience on concurrency is just through the roof, imho (dare I say even better than rust). STM is just the best kind of magic.
- pjmlp 4y agoYes, as they say back home, "when you are going I am coming back". "Parallel and Concurrent Programming in Haskell" (2013) https://www.oreilly.com/library/view/parallel-and-concurrent/9781449335939/ https://www.oreilly.com/library/view/parallel-and-concurrent...
- pdimitar 4y agoI've heard that many times, still skeptical after trying Haskell thrice. Have Haskell's ergonomics improved? I feel your snark is unjustified. You might be putting people in two extremes: wise elders and hip kids. There's a huge amount of people in-between however. (Also, the saying actually is: "You're going to where I am coming back from".) Find me something like Erlang/Elixir with the speed of Rust and I won't learn another programming language ever again. No? Then the search continues. So far Haskell hasn't impressed. In all honesty Rust is quite hard to put in that niche as well since its `async` stuff is extremely annoying and hard to get right but I guess the tries are still ongoing. OCaml is progressing but who knows when will they get there.
- kcsrk 4y agoFor nested parallel computations (think Scientific Programming, where one would use OpenMP, Rust Rayon, etc), we have domainslib [1]. Eio, a direct-style, effect-based IO library is pretty competitive against Rust Tokio [2]. The performance will only get better as we get closer to the 5.0 release. [1] https://github.com/ocaml-multicore/domainslib https://github.com/ocaml-multicore/domainslib [2] See the http server performance graphs at https://tarides.com/blog/2022-03-01-segfault-systems-joins-tarides#ecosystem https://tarides.com/blog/2022-03-01-segfault-systems-joins-t...
- pdimitar 4y agoVery impressive, thank you. I admit I'm not much of an early adopter -- hence my comment that I'll be waiting for the official 5.0 release. I've scanned several articles (some made by you) and I very much like what I'm seeing.