News for hackers. Stuff that matters.
Re:Python’s “type hints” are a bit of a disappointment to me by mjn on Thursday April 21, 2022 @11:13PM (#31117793)
> 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

There are no comments on this comment yet.