3 ms·
Do you really want type inference to be global? The idea that changing one line in a function might change the type of a whole other function — and thus variabl
by bobbylarrybobby 1y ago
Do you really want type inference to be global? The idea that changing one line in a function might change the type of a whole other function — and thus variables assigned to its result, which affect the types of other functions, which ... — well it just seems like a lot to have to reason about.
- BoppreH 1y agoYes, with the caveat that I'm assuming generics here. I'm working on a language where you can have: def add(a, b): return a + b add(1, 2) # Works add('a', 'b') # Works add(1, 'b') # Type error! So changing one line should never break things outside its "light cone" (call stack + reachable data structures).