It checks *at compile time* whether a call to a class is type consistent.
Without declaring any of the classes involved in any of the variables.
Because it can (as could any other dynamically typed language that cared to)
What I've been saying is, if the inferred type is what you want, you don't need the type declaration, but you may still want it as a form of documentation.
It checks them because it can, and because it was designed so that it can.
Not every language could, if it cared to.
Haskell, Zig, and Rust AFAIK don't need type declarations most of the time either.
Also, the modern so called "C++" has grown an `auto` keyword which in many cases can be used for type inference as well...
Scala and Kotlin have type inference to some extent as well, from what I've read.
But yeah, for me too OCaml was the first language where I saw type inference at work.
This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!