Soft typing: An approach to type checking for dynamically typed languages

In an effort to avoid improper use of program functions, modern programming languages employ some kind of preventative type system. These type systems can be classified as either static or dynamic. Static type systems detect "ill-typed" program phrases at compile-time, whereas dynamic type...

Full description

Bibliographic Details
Main Author: Fagan, Mike
Other Authors: Cartwright, Robert S.
Format: Others
Language:English
Published: 2009
Subjects:
Online Access:http://hdl.handle.net/1911/16439
id ndltd-RICE-oai-scholarship.rice.edu-1911-16439
record_format oai_dc
spelling ndltd-RICE-oai-scholarship.rice.edu-1911-164392013-10-23T04:08:49ZSoft typing: An approach to type checking for dynamically typed languagesFagan, MikeComputer ScienceIn an effort to avoid improper use of program functions, modern programming languages employ some kind of preventative type system. These type systems can be classified as either static or dynamic. Static type systems detect "ill-typed" program phrases at compile-time, whereas dynamic type systems detect "ill-typed" phrases at run-time. Static typing systems have two important advantages over dynamically typed systems: First, they provide important feedback to the programmer by detecting a large class of program errors before execution. Second, they extract information that a compiler can exploit to produce more efficient code. The price paid for these advantages, however, is a loss of expressiveness and modularity. It is easy to prove that a static type system for an "interesting" programming language necessarily excludes some "good" programs. This paper focuses on the problem of designing programming systems that retain the all the expressiveness of dynamic typing, but still offer the early error detection and improved optimization opportunities of static typing. To that end, we introduce a concept called soft typing. The key concept of soft typing is that a type checker need not reject programs containing statically "ill-typed" phrases. Instead, the soft type checker inserts explicit run-time checks. Thus, there are two issues to be addressed in the design of soft typing systems. First, the typing mechanism must provide reasonable feedback to programmers accustomed to dynamically typed-languages. Current static systems fail to satisfy the programmer's intuition about correctness on many programs. Second, a soft typing system must sensibly insert run-time checks (when necessary). This paper develops a type system and checking algorithms that are suitable for soft typing a significant class of programming languages.Cartwright, Robert S.2009-06-03T23:58:01Z2009-06-03T23:58:01Z1991ThesisText174 p.application/pdfhttp://hdl.handle.net/1911/16439eng
collection NDLTD
language English
format Others
sources NDLTD
topic Computer Science
spellingShingle Computer Science
Fagan, Mike
Soft typing: An approach to type checking for dynamically typed languages
description In an effort to avoid improper use of program functions, modern programming languages employ some kind of preventative type system. These type systems can be classified as either static or dynamic. Static type systems detect "ill-typed" program phrases at compile-time, whereas dynamic type systems detect "ill-typed" phrases at run-time. Static typing systems have two important advantages over dynamically typed systems: First, they provide important feedback to the programmer by detecting a large class of program errors before execution. Second, they extract information that a compiler can exploit to produce more efficient code. The price paid for these advantages, however, is a loss of expressiveness and modularity. It is easy to prove that a static type system for an "interesting" programming language necessarily excludes some "good" programs. This paper focuses on the problem of designing programming systems that retain the all the expressiveness of dynamic typing, but still offer the early error detection and improved optimization opportunities of static typing. To that end, we introduce a concept called soft typing. The key concept of soft typing is that a type checker need not reject programs containing statically "ill-typed" phrases. Instead, the soft type checker inserts explicit run-time checks. Thus, there are two issues to be addressed in the design of soft typing systems. First, the typing mechanism must provide reasonable feedback to programmers accustomed to dynamically typed-languages. Current static systems fail to satisfy the programmer's intuition about correctness on many programs. Second, a soft typing system must sensibly insert run-time checks (when necessary). This paper develops a type system and checking algorithms that are suitable for soft typing a significant class of programming languages.
author2 Cartwright, Robert S.
author_facet Cartwright, Robert S.
Fagan, Mike
author Fagan, Mike
author_sort Fagan, Mike
title Soft typing: An approach to type checking for dynamically typed languages
title_short Soft typing: An approach to type checking for dynamically typed languages
title_full Soft typing: An approach to type checking for dynamically typed languages
title_fullStr Soft typing: An approach to type checking for dynamically typed languages
title_full_unstemmed Soft typing: An approach to type checking for dynamically typed languages
title_sort soft typing: an approach to type checking for dynamically typed languages
publishDate 2009
url http://hdl.handle.net/1911/16439
work_keys_str_mv AT faganmike softtypinganapproachtotypecheckingfordynamicallytypedlanguages
_version_ 1716610036534345728