3 ms·
I've always wondered if we shouldn't be pushing more for type inference with flow analysis. I consider static type checking a must, but the voices opposing type
by BoppreH 3y ago
I've always wondered if we shouldn't be pushing more for type inference with flow analysis. I consider static type checking a must, but the voices opposing type annotations have some valid points: it pollutes the source code, slows down prototyping, and only catches a limited class of errors.
A static checker with global type inference could be a middle ground. Pylance/Pyright already does that for most VS Code users. A more advanced form of this could track types that are too tedious for humans, like list emptiness, bounds, string alphabet, functions that can raise exceptions, idempotence, side effects, etc.
Those types can then be shown in the IDE, according to user preference, like docs or source control metadata.
I have a feeling that with enough caching this could be done with ok performance, but I hear that useful error reporting is an unsolved problem.