2 ms·
This is where terminology fails us. I really wish the terms "static typing" and "dynamic typing" as presently used would be gone entirely. What you're saying i
by int_19h 8y ago
This is where terminology fails us. I really wish the terms "static typing" and "dynamic typing" as presently used would be gone entirely.
What you're saying is that explicit type annotations can be enforced at compile time. However, they can also be enforced at runtime, and they're no less safe for that - you just see the errors later, but any call that would be blocked by a static type checker can similarly be blocked by a dynamic checker. I think that's what OP refers to by "runtime checking", not writing explicit asserts.
- stephenr 8y agoThankyou, im glad someone understood the point. A similar example that web-focused developers are likely familiar with, is type hinting in PHP. For the developer's purpose, there is no 'compile' step (yes the code is compiled and then run, but it happens at request time so its not realistic to compare it to compile time type checking in a compile language like Java). The 'compile/run' lifetime (in browser based JS) bears similarity to that of PHP: compile time effectively is run time, because it's compiled during the request and then executed immediately.
- arcticbull 8y ago100% it's just as safe, though I doubt the program is more reliable as it's harder to catch issues later on.