4 ms·
> 1. If you're using a dynamic language, then _by definition_ the language will not enforce your static hints at runtime. Counterexample: PHP is a dynamic lang
by theodorejb 4y ago
> 1. If you're using a dynamic language, then _by definition_ the language will not enforce your static hints at runtime.
Counterexample: PHP is a dynamic language which enforces static type declarations at runtime.
- ledauphin 4y agoMeh. you can do the same thing in Python if you really want - there are dynamic interpreter shims that can do this. The point is that it is not expected by definition, since by definition, static != runtime.
- lolinder 4y agoYou're assuming that type hints are by definition static-only. There's no particular reason why type hints can't be both statically and dynamically enforceable, as they are in PHP.
- dgb23 4y agoFun fact: it will still do type coercion in that scenario without strict mode. And you cannot annotate assignments. Otherwise it’s pretty useful.