UNIVERSITY OF CALIFORNIA, SAN DIEGO Nested Refinement Types for JavaScript A dissertation submitted in partial satisfaction of the requirements for the degree of Doctor of Philosophy in Computer Science by Ravi Chugh Committee in charge: Professor Ranjit Jhala, Chair Professor Samuel R. Buss Professor Alin Deutsch Professor Cormac Flanagan Professor Sorin Lerner 2013 Copyright Ravi Chugh, 2013 All rights reserved. The Dissertation of Ravi Chugh is approved and is acceptable in quality and form for publication on microfilm and electronically: Chair University of California, San Diego 2013 iii EPIGRAPH No grammatical rules have sufficient authority to control the firm and established usage of language. Joseph M. Williams “Style: Ten Lessons in Clarity and Grace" iv TABLE OF CONTENTS Signature Page . iii Epigraph . iv Table of Contents . v List of Figures . viii Preface............................................................................... ix Acknowledgements . x Vita.................................................................................. xii Abstract of the Dissertation . xiii Part I Prologue 1 Chapter 1 Introduction. 2 1.1 An Untyped l-calculus . 2 1.2 Type Systems . 6 1.2.1 Simple Types and Subtyping . 7 1.2.2 Richer Syntactic Types . 9 1.2.3 Refinement Types . 11 1.2.4 Higher-Order Dependent Types . 16 1.3 “Dynamic” Languages . 17 1.3.1 Untagged Unions and Path Sensitivity . 17 1.3.2 Dictionary-Style Objects . 18 1.3.3 Extensible Objects . 19 1.3.4 Prototype Inheritance . 19 1.3.5 Dynamically Loaded Code . 20 1.4 Hybrid Typing . 20 1.5 Contributions . 20 Part II Nested Refinements 23 Chapter 2 System D . 24 2.1 Overview .................................................................... 27 2.1.1 Simple Refinements . 28 2.1.2 Nested Refinements . 29 2.1.3 Dictionaries . 31 2.1.4 Type Constructors . 33 2.1.5 Polymorphism . 34 2.1.6 All Together Now . 35 2.2 Syntax and Semantics . 37 2.3 Type Checking . 40 v 2.3.1 Well-Formedness . 41 2.3.2 Typing . 43 2.3.3 Subtyping . 46 2.4 Type Soundness . 49 2.4.1 The Problem: Substitution . 50 2.4.2 The Solution: Stratified System D . 51 Chapter 3 Algorithmic Typing . 54 3.1 Algorithmic Subtyping . 54 3.2 Bidirectional Type Checking . 57 3.3 Soundness . 61 Chapter 4 Extensions to Subtyping . 63 4.1 Joins......................................................................... 63 4.2 Meets........................................................................ 64 4.3 Formula Normalization . 66 4.4 Soundness . 66 4.5 Algorithmic Typing . 67 Part III From System D to JavaScript 69 Chapter 5 System !D . 70 5.1 Overview .................................................................... 72 5.1.1 Imperative Updates . 73 5.1.2 Mutable Objects . 75 5.1.3 Function Types . 77 5.1.4 Collections . 79 5.2 Syntax and Semantics . 82 5.3 Type Checking . 85 5.3.1 Well-Formedness . 85 5.3.2 Value Typing . 86 5.3.3 Expression Typing . 88 5.3.4 Subtyping . 91 5.3.5 Type Soundness . 92 Chapter 6 System DJS . ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages190 Page
-
File Size-