Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think Rust and Ocaml are very different languages.

I went into Rust thinking I could use it like a kind of curly brace Ocaml, and that's totally off. It's much more like a very strict modern C++ with a lot of historical cruft removed.

OCaml is much more concise and higher level. It also doesn't let you reason about memory layout really well. Plus Ocaml has parametric polymorphism and higher order modules, compared with rusts ad-hoc polymorphism and traits. In Ocaml the idiomatic solution is often recursion but that will blow the rust stack.

(full disclaimer, I'm much better at Ocaml than I am Rust, and I'm really not great at Ocaml)



rust has parametric polymorphism, it just calls it generics—and traits correspond to ocaml signatures. These aren't useful juxtapositions.


I'll take your word that I'm misusing the terms.

Key difference - as a user - is in Ocaml I'd write a module with a bunch of functions. In rust I'd write a struct with a bunch of methods. It feels very different even if it solves the same things.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: