@article{oai:nagoya.repo.nii.ac.jp:00019061, author = {Yamada, Akihisa and Kusakari, Keiichirou and Sakabe, Toshiki and Sakai, Masahiko and Nishida, Naoki}, issue = {2}, journal = {情報処理学会論文誌, プログラミング}, month = {Mar}, note = {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.}, pages = {16--24}, title = {A Sound Type System for Typing Runtime Errors}, volume = {5}, year = {2012} }