4 ms·
They have gradual typing but I believe they're still enforced as runtime contracts, making them not static types.
by nilved 10y ago
They have gradual typing but I believe they're still enforced as runtime contracts, making them not static types.
- kbp 10y agoTechnically, the Common Lisp standard leaves it up to the implementation what to do with type declarations--in practice, I get compile time warnings for violating them (as well as for violating inferred types). Type declarations will not lead to runtime checks, you need to use CHECK-TYPE or similar for that. Typed Racket is more extensive and gives errors at compile time. I don't know very much about how it works in Clojure.
- junke 10y agoIn SBCL, type declarations are treated as assertions. If the compiler is sure the assertion is valid without doing runtime checks, it can remove them. The optimization levels are also taken into account (http://www.sbcl.org/manual/index.html#Handling-of-Types http://www.sbcl.org/manual/index.html#Handling-of-Types).
- thinkmoore 10y agoIn a Typed Racket program that does not import any untyped racket code, there is no runtime enforcement. Runtime contracts are only introduced at the boundary between typed and untyped code. This allows programs to be soundly transitioned from untyped to partially typed to fully typed.