by lars · 11y ago · 0 comments
With static typing, the compiler can catch type errors early, at the cost of rejecting some otherwise valid programs.
With dynamic typing, that type checking is delayed until execution time. More programs are valid, but type errors are caught late.
With AtScript-style late type checking, they took the dynamic type system and introduced more type errors. This decreases the amount of valid programs, yet catches no errors at compile time. It does nothing but increase the amount of bugs.
http://www.cs.umd.edu/~aseem/safets.pdf
It describes an extension to TypeScript that includes efficient runtime type checking. They encode type information only in situations where checks are necessary, and only information that cannot be otherwise deduced from the context.
Edit: to clarify, runtime type information should not be used to check for types again, but rather to do things similar to Java's reflection.
var length = rtts.type(name.length, rtts.int);
https://docs.google.com/document/d/11YUzC-1d0V1-Q3V0fQ7KSit9...