17 ms·
> So static type system are conservative. If variable v is supposed to have type T and the compiler cannot deduce that it for sure is then a type error is gener
by dragonwriter 3y ago
> So static type system are conservative. If variable v is supposed to have type T and the compiler cannot deduce that it for sure is then a type error is generated. Hence you need option types because static type systems are not powerful enough to deduce whether a given nullable variable actually can be null or not.
Option types serve other purposes, like composability; tracing program flow can determine the points where a nullable type either (a) will always be null, or (b) will never be null, and many type checkers for type systems with nullable types (or, more generally, non-discriminated unions, nullable types are just one example.)