7 ms·
Not for nothing, but static type checking isn't some kind of fad. It's been the rule, not the exception, since the 1980s at least.
by Veuxdo 4y ago
Not for nothing, but static type checking isn't some kind of fad. It's been the rule, not the exception, since the 1980s at least.
- IgorPartola 4y agoFor some languages it’s a whole lot more important than others. Python and JavaScript are memory-safe so you don’t need to worry about writing a bigger object into a too-small memory allocation. You will discover that you reversed the order for parameters to a function by running your code with much less effort than annotating all your code. This type annotation is entirely useless: def get_user(email: str, create_if_not_exists: bool)
- pfdietz 4y agoAdditionally, if you are testing the code anyway for other reasons (like, to check that the logic is correct), you exercise the dynamic type checking for free.
- blep_ 4y agoAnd then it silently creates a user named True because the non-empty email address you passed as `create_if_not_exists` evaluated as truthy.