Re:“The days of using untyped languages on non-trivial proje...
by cxr on Friday July 14, 2023 @01:57PM
(#36727553)
> Explicit typing of structure fields and function parameters allows automatic generation of reasonably useful documentation.
Rather than documentation from inline types, you could go the other direction as well, i.e., start with reasonably useful documentation and then have the typechecker read the docs to validate the code for exactly the same properties that it does with inline type annotations.
C++ used to suffer from "for" loops with insanely long type declarations for iterator variables. "auto" fixed that.
Inter-function type inference, while technically possible, is just too confusing for people reading the code. So that went away. Mostly, type inference is now forward only. Inverse type inference through long chains is, again, possible but too confusing.
Explicit typing of structure fields and function parameters allows automatic generation of reasonably useful documentation. That gives programmers anchor points at which they can see types.
So this has become a solved problem for compiled languages.