News for hackers. Stuff that matters.
Re:OCaml 4.10 by giornogiovanna on Saturday February 22, 2020 @06:44AM (#22390525)
Besides GC and the lightweight syntax (relative to Rust), what is it about OCaml that makes it so wonderful for implementing complicated algorithms?
Re:OCaml 4.10 by Yoric on Saturday February 22, 2020 @07:48AM (#22390731)
Well, the big one is GC.

Here are a few others:

- both polymorphic variants and GADTs are extremely powerful mechanisms to let you keep track of invariants, in a manner that cannot be replicated readably in Rust so far;

- OCaml's pattern-matching is a bit more flexible than Rust's ;

- (thanks to the GC) OCaml's closures are much more flexible than Rust closures;

- I guess OCaml's blindingly fast exceptions can be useful for some algorithms, although I haven't really experienced the need for them myself.

Again, that's not to say that Rust doesn't have great stuff for it (affine types 4eva!) or that OCaml doesn't have its own limitations – Rust is currently my main language and I do not regret it.

But there are some algorithms that I really don't want to write in Rust. Recently, for instance, I stumbled upon this: http://weblog.jamisbuck.org/2010/12/29/maze-generation-eller... . Trivial algorithm, trivial to write in OCaml, feasible but much less straightforward in Rust.

Re:OCaml 4.10 by pjmlp on Saturday February 22, 2020 @07:30AM (#22390669)
Exactly that, lock-free algorithms are specially hard to get a correct implementation without tracing GC support.
Re:OCaml 4.10 by terminaljunkid on Saturday February 22, 2020 @09:09AM (#22391089)
Why?
Re:OCaml 4.10 by pjmlp on Saturday February 22, 2020 @09:48AM (#22391275)
Here is an overview, read also the comments.

https://concurrencyfreaks.blogspot.com/2017/08/why-is-memory...