| 1. Dynamic typing says "anything I can do these operations on, I accept as input". This lets you accept input from code that doesn't have something that fits the strict definition of what input you were expecting. 2. Dynamic typing lets you change what shape your data is without having to change type annotations everywhere. Problem is, I think both of these are deeply flawed: 1. If you're writing something nontrivial, you probably have several layers of nested function calls, some of which may be calls to libraries that are not yours. If you're saying "anything I can do these operations on, I accept", it becomes very difficult to say what the full extent of "these operations" are. Thus it becomes hard to say whether the caller is passing in valid input. You can "just try it", but that becomes hard if you care about it working in all cases. 2. Refactoring IDEs are a thing these days. You want to change the type signature? Press the button. Even better, it will tell you everything you broke by making the change - everywhere where you're doing something that the new type can't do. Without types, sure, you can just change it without pressing the button. Now try to find all the places that you broke. It may be possible to construct a better steelman than I have done. For myself, even trying to steelman the position, I find it incredibly unconvincing. |
https://ics.uci.edu/~lopes/teaching/inf212W12/readings/rdl04...