2 ms·
I wish people wouldn't conflate dynamic typing with weak typing. Python, for example, is dynamically typed, but it's strongly typed too. You don't get bugs like
by globular-toast 3y ago
I wish people wouldn't conflate dynamic typing with weak typing. Python, for example, is dynamically typed, but it's strongly typed too. You don't get bugs like `1 + "2" = "12"` in a strongly typed language like Python.
You can still get runtime bugs, of course, but that kind of thing would manifest as a TypeError or something. All of those bugs could be caught with tests.
I like dynamically typed languages. They are simply the pragmatic choice for the vast majority of code that will ever be written. But being dynamic doesn't mean you can't do types. Python has optional type hinting and checkers like mypy are very good. Common Lisp has features that enable you to declare types and get near-native speed binaries.
These days I do type my Python code for many of the reasons given in the article, but I still enjoy using a dynamically typed language underneath.
- tonyedgecombe 3y ago>You don't get bugs like `1 + "2" = "12"` in a strongly typed language like Python. That's more about type coercion which you can avoid in dynamic languages. See === vs == in JavaScript.