Type hints catch bugs early. They enable autocompletion. They help document your code.
Static languages are more robust than dynamic, but it should be plain to see how gradual typing (python, typescript) can be useful. Applications written purely dynamically are just asking for trouble.
I agree, they increase productivity and help avoid headaches in large projects with many contributors. They are easy to write and have good IDE support. They aren't a crutch for bad code - they make good code even better.
Types catch a very specific type of bug early that is caused by your functions being too damn long, and getting too smart with data structures. Typing doesn't solve the cause. I will not accept trash code in my repos that has type hints on it just so some dumbass can hit Ctrl+Space instead of finishing typing a word. The PR will be left with comments regarding the opacity of their variable names, functions with too many responsibilities, and oversharing of data, and left unmerged until it's architected better.
So static languages are just a fad? Grow up. Devs like you are walking representations of the dunning-kruger effect.
Functions being too long? Wut? Type hints have nothing to do with that. They generally sit on the arguments and return values. The thing they help with is having modular code, not the opposite.
View all comments
Show parent comment
23
u/XtremeGoose f'I only use Py {sys.version[:3]}' Jun 06 '21
What nonsense.
Type hints catch bugs early. They enable autocompletion. They help document your code.
Static languages are more robust than dynamic, but it should be plain to see how gradual typing (python, typescript) can be useful. Applications written purely dynamically are just asking for trouble.