Preemptive type checking in dynamically typed programs
Preemptive type checking in dynamically typed programs
With the rise of languages such as JavaScript, dynamically typed languages have gained a strong foothold in the programming language landscape. These languages are very well suited for rapid prototyping and for use with agile programming methodologies. However, programmers would benefit from the ability to detect type errors in their code early, without imposing unnecessary restrictions on their programs.
Here we describe a new type inference system that identifies potential type errors through a flow-sensitive static analysis. This analysis is invoked at a very late stage, after the compilation to bytecode and initialisation of the program. It computes for every expression the variable’s present (from the values that it has last been assigned) and future (with which it is used in the further program execution) types, respectively. Using this information, our mechanism inserts type checks at strategic points in the original program. We prove that these checks, inserted as early as possible, preempt type errors earlier than existing type systems. We further show that these checks do not change the semantics of programs that do not raise type errors.
Preemptive type checking can be added to existing languages without the need to modify the existing runtime environment. We show this with an implementation for the Python language and demonstrate its effectiveness on a number of benchmarks.
Grech, Neville
b8afe72a-04a8-48cf-8193-cf1d9b5edfa5
November 2013
Grech, Neville
b8afe72a-04a8-48cf-8193-cf1d9b5edfa5
Rathke, Julian
dba0b571-545c-4c31-9aec-5f70c231774b
Grech, Neville
(2013)
Preemptive type checking in dynamically typed programs.
University of Southampton, Physical Sciences and Engineering, Doctoral Thesis, 148pp.
Record type:
Thesis
(Doctoral)
Abstract
With the rise of languages such as JavaScript, dynamically typed languages have gained a strong foothold in the programming language landscape. These languages are very well suited for rapid prototyping and for use with agile programming methodologies. However, programmers would benefit from the ability to detect type errors in their code early, without imposing unnecessary restrictions on their programs.
Here we describe a new type inference system that identifies potential type errors through a flow-sensitive static analysis. This analysis is invoked at a very late stage, after the compilation to bytecode and initialisation of the program. It computes for every expression the variable’s present (from the values that it has last been assigned) and future (with which it is used in the further program execution) types, respectively. Using this information, our mechanism inserts type checks at strategic points in the original program. We prove that these checks, inserted as early as possible, preempt type errors earlier than existing type systems. We further show that these checks do not change the semantics of programs that do not raise type errors.
Preemptive type checking can be added to existing languages without the need to modify the existing runtime environment. We show this with an implementation for the Python language and demonstrate its effectiveness on a number of benchmarks.
Text
__soton.ac.uk_ude_PersonalFiles_Users_slb1_mydocuments_grech.pdf
- Other
More information
Published date: November 2013
Organisations:
University of Southampton, Electronic & Software Systems
Identifiers
Local EPrints ID: 361277
URI: http://eprints.soton.ac.uk/id/eprint/361277
PURE UUID: 4949b9cd-8b17-4886-b178-ddf7b88893ba
Catalogue record
Date deposited: 20 Jan 2014 13:40
Last modified: 14 Mar 2024 15:48
Export record
Contributors
Author:
Neville Grech
Thesis advisor:
Julian Rathke
Download statistics
Downloads from ePrints over the past year. Other digital versions may also be available to download e.g. from the publisher's website.
View more statistics