Abstract
Dynamically typed languages such as Scheme are widely adopted because of their rich expressiveness. However, there is the drawback that dynamic typing cannot detect runtime errors at compile time. In this paper, we propose a type system which enables static detection of runtime errors. The key idea of our approach is to introduce a special type, called the error type, for expressions that cause runtime errors. The proposed type system brings out the benefit of the error type with set-theoretic union, intersection and complement types, recursive types, parametric polymorphism and subtyping. While existing type systems usually ensure that evaluation never causes runtime errors for typed expressions, our system ensures that evaluation always causes runtime errors for expressions typed with the error type. Likewise, our system also ensures that evaluation never causes errors for expressions typed with any type that does not contain the error type. Under the usual definition of subtyping, it is difficult to syntactically prove the soundness of our type system. We redefine subtyping by introducing the notion of intransitive subtyping, and syntactically prove the soundness under the new definition.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.