4 ms·
> If you're using a dynamic language, then _by definition_ the language will not enforce your static hints at runtime. I don't think this follows by definition
by mjn 4y ago
> If you're using a dynamic language, then _by definition_ the language will not enforce your static hints at runtime.
I don't think this follows by definition. It's common not to check the static hints at runtime, but a dynamic language could choose to treat them as contracts or assertions. Over in Lisp-land, SBCL will enforce static type declarations at runtime [1], contrary to most other Lisp compilers, at least under the default compilation settings (you can force it to skip the checks by compiling with a low "safety" level). If the compiler can prove that a static type declaration always holds, it will omit the runtime check; otherwise it will compile it into a runtime assertion.
[1] http://www.sbcl.org/manual/#Declarations-as-Assertions http://www.sbcl.org/manual/#Declarations-as-Assertions