Preemptive type checking
Preemptive type checking
Dynamically typed languages languages are very well suited for rapid prototyping, agile programming methodologies and rapidly evolving software. However, programmers can still benefit from the ability to detect type errors in their code early, in particular if this does not impose restrictions on their programming style.
In this paper we describe a new type checking system that identifies potential type errors in such languages through a flow-sensitive static analysis. 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, the mechanism inserts type checks at strategic points in the original program. We prove that these checks are inserted as early as possible and 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. Instead, it can be invoked at a very late stage, after the compilation to bytecode and initialisation of the program. We demonstrate an implementation of this for the Python language, and its effectiveness on a number of standard benchmarks.
151-181
Grech, Neville
b8afe72a-04a8-48cf-8193-cf1d9b5edfa5
Fischer, Bernd
0c9575e6-d099-47f1-b3a2-2dbc93c53d18
Rathke, Julian
dba0b571-545c-4c31-9aec-5f70c231774b
December 2018
Grech, Neville
b8afe72a-04a8-48cf-8193-cf1d9b5edfa5
Fischer, Bernd
0c9575e6-d099-47f1-b3a2-2dbc93c53d18
Rathke, Julian
dba0b571-545c-4c31-9aec-5f70c231774b
Grech, Neville, Fischer, Bernd and Rathke, Julian
(2018)
Preemptive type checking.
Journal of Logical and Algebraic Methods in Programming, 101, .
(doi:10.1016/j.jlamp.2018.08.003).
Abstract
Dynamically typed languages languages are very well suited for rapid prototyping, agile programming methodologies and rapidly evolving software. However, programmers can still benefit from the ability to detect type errors in their code early, in particular if this does not impose restrictions on their programming style.
In this paper we describe a new type checking system that identifies potential type errors in such languages through a flow-sensitive static analysis. 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, the mechanism inserts type checks at strategic points in the original program. We prove that these checks are inserted as early as possible and 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. Instead, it can be invoked at a very late stage, after the compilation to bytecode and initialisation of the program. We demonstrate an implementation of this for the Python language, and its effectiveness on a number of standard benchmarks.
Text
Preemptive type checking
- Accepted Manuscript
Text
Preemptive-type-checki_2018_Journal-of-Logical-and-Algebraic-Methods-in-Prog
- Version of Record
Restricted to Repository staff only
Request a copy
More information
Accepted/In Press date: 14 August 2018
e-pub ahead of print date: 26 September 2018
Published date: December 2018
Identifiers
Local EPrints ID: 421793
URI: http://eprints.soton.ac.uk/id/eprint/421793
ISSN: 2352-2208
PURE UUID: 56c0cba8-df91-41a3-8e31-3e1ea184874f
Catalogue record
Date deposited: 27 Jun 2018 16:31
Last modified: 16 Mar 2024 06:28
Export record
Altmetrics
Contributors
Author:
Neville Grech
Author:
Bernd Fischer
Author:
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