Re:Two Years of OCaml
by rwmj on Tuesday May 02, 2023 @05:15AM
(#35785062)
In virt-v2v we eventually enforced that every module file also has a corresponding interface file: https://github.com/libguestfs/virt-v2v/blob/master/check-mli...
[ Parent
| on HN ]
Probably if you need to do that it should just be enforced by the compiler. It's pretty clear to me (and the author of this post) that Rust got this right - small scale type inference is fine (in function bodies) but you really want explicit types for functions and up.
Without that, you lose out massively on readability and error message quality.
In Sail, I have IDE type inlays working but it barely helps with reachability because half the types are inferred as generic.
As a user of OCaml I have to disagree. Rust requires far too many type annotations and they are mostly unnecessary and clutter everything up (particularly with it's very heavy syntax). In OCaml my editor shows me types if I mouse over a variable, and if I need to document the code I can do that, but I don't need to.