3 ms·
Odd, I feel wildly different about the “point” of types. For me, in cases where the type checker correctly infers the type saves me work. If I depend on the ret
by Spivak 4y ago
Odd, I feel wildly different about the “point” of types. For me, in cases where the type checker correctly infers the type saves me work. If I depend on the return type of my function being string and I change it the type checker will complain at the call site making the annotation pointless. If I don’t depend on it anywhere I can safely change it again making the annotation pointless.
For me the type checker exists to help me understand relationships and integration points, any time spent fucking with the types for its own sake is a waste. If I find a situation where updating the code would require I update the types I’ve just written the same thing twice for some reason. I want the type checker to tell me when things are genuinely bugs in my code because of incompatible types not because it doesn’t match the annotation.
Even in libraries where I can’t see all the callsites all my promises to the caller are encoded in the tests which to me is a stronger guarantee and the type checker will still catch it just over there.