3 ms·
Explicit typing causes errors to be reported early, aka fail fast. This is very helpful to debugging, because the closer the error is to its source, the easier
by int_19h 6y ago
Explicit typing causes errors to be reported early, aka fail fast. This is very helpful to debugging, because the closer the error is to its source, the easier it is to understand the cause. In a language with dynamic typing, it's not uncommon for the "wrong thing" to be passed around for a very long time before some piece of code actually tries to use it, and blows up because it's not what it expected it to be. Tracking down where such a value came from can be very tedious in large codebases.
(In statically typed languages with implicit nullability, nulls create the same problem.)
Basically, explicit contracts are Good, and types are a subset of explicit contracts that are more easily enforceable than most.