Hacker News new | ask | show | jobs
by Animats 3 days ago
The modern approach seems to be to require full typing on items seen from outside the function or object. Within functions, have the compiler infer as much as it can. Newer languages (Go, Rust) seem to be converging on this approach.

Function parameters need type info as guidance for people and LLMs calling the function. Even though cross-function type inference is technically possible, it's too confusing. Long-distance inference failures tend to generate poor messages.

Within a function, if you have typed parameters, the type inference engine has a local starting point and a good chance of success on most local variables.

Unchecked advisory typing in Python was a terrible idea. All the work of writing type declarations with none of the benefits.