4 ms·
> It contributes to boilerplate and increases cognitive load, in my opinion. In my experience with OCaml, I found that knowing the types of my variables reduce
by johnisgood 7y ago
> It contributes to boilerplate and increases cognitive load, in my opinion.
In my experience with OCaml, I found that knowing the types of my variables reduce the cognitive load of trying to infer the types myself when reading the code, so despite OCaml supporting type inference, I use explicit type annotations almost everywhere.
- a0 7y agoBeing a Vim/Merlin user I normally just type `<Leader>t` to see the type of the value under the cursor (this maps to `:MerlinTypeOf` if I recall correctly). What I do use type annotations for is debugging. If the compiler finds a type error, in some situations it helps adding type annotations to find where the actual error is.
- johnisgood 7y agoI do use that feature, too, for functions, in Emacs. So in the mode line I see for example: Array.length: 'a array -> int. I find it quite useful.