A Spectrum of Type Soundness and Performance. Ben Greenman & Matthias Felleisen Northeastern University

Size: px
Start display at page:

Download "A Spectrum of Type Soundness and Performance. Ben Greenman & Matthias Felleisen Northeastern University"

Transcription

1 A Spectrum of Type Soundness and Performance Ben Greenman & Matthias Felleisen Northeastern University

2 Is type soundness all-or-nothing? Can adding types slow down a program?

3 Migratory Typing

4

5

6

7 Typed/Untyped Languages

8 Typed/Untyped Languages Gradualtalk Typed Racket TPD StrongScript* mypy Pallene Grace Flow Hack Pyre Pytype rtc SafeTS* Strongtalk TypeScript Typed Clojure Typed Lua Pyret Thorn* Dart 1 Dart 2* Nom* Pycket Reticulated

9 Oldest by Date Newest Strongtalk Hack Typed Racket Grace Thorn* Gradualtalk Pallene Typed Lua Pyre Reticulated Dart 2* mypy StrongScript* TypeScript Flow Typed Clojure Pytype Dart 1 SafeTS* rtc TPD Pyret Nom* Pycket

10 Academia by Creator Industry Gradualtalk Typed Racket TPD StrongScript* Pallene Grace rtc SafeTS* Strongtalk Typed Clojure Typed Lua Pyret Thorn* Nom* Pycket Reticulated mypy Flow Hack Pyre Pytype TypeScript Dart 1 Dart 2*

11 Sound by Theory Unsound Gradualtalk Typed Racket TPD StrongScript* Pallene Grace SafeTS* Pyret Thorn* Dart 2* Nom* Pycket Reticulated mypy Flow Hack Pyre Pytype rtc Strongtalk TypeScript Typed Clojure Typed Lua Dart 1

12 Not Dead by Performance Dead Gradualtalk TPD StrongScript* mypy Pallene Grace Flow Hack Pyre Pytype rtc SafeTS* Strongtalk TypeScript Typed Clojure Typed Lua Pyret Thorn* Dart 1 Dart 2* Nom* Pycket Reticulated Typed Racket (the word 'dead' is used here in a technical sense)

13 Chaos!

14

15 H E 1

16 H higher-order semantics E erasure semantics 1 first-order semantics

17 Contributions (1/2) Model: - one mixed-typed language - one surface type system - three semantics H E 1

18 Contributions (2/2) H E 1

19 Contributions (2/2) H E 1 H E 1

20 Contributions (2/2) Implementation: - Racket syntax/types - three compilers - the first controlled performance experiment H E 1

21 Model

22 t = Nat Int t t t t Nat <: Int

23 t = Nat Int t t t t Nat <: Int v = n i v,v λ(x)e λ(x:t)e n i

24 t = Nat Int t t t t Nat <: Int v = n i v,v λ(x)e λ(x:t)e n i e =... dyn t e stat t e

25 t = Nat Int t t t t Nat <: Int v = n i v,v λ(x)e λ(x:t)e n i e =... dyn t e stat t e e dyn t e : t e : t stat t e

26 Γ = { fib : Nat Nat norm : Nat Nat Nat map : (Nat Nat) Nat Nat Nat Nat Γ fib (dyn Nat -1) : Nat Γ norm (dyn Nat Nat -1,-2 ) : Nat Γ map (dyn (Nat Nat) (λ(x)e)) y : Nat Nat

27 Nat fib -1 Nat Nat norm -1,-2 Nat Nat map y λ(x)e

28 H E 1

29 H E 1

30 higher-order H Nat fib -1 Nat Nat norm -1,-2 Nat Nat map y λ(x)e

31 H E 1

32 TPD Pycket Gradualtalk Typed Racket H E 1

33 TPD Pycket Gradualtalk Typed Racket H E 1

34 erasure E Nat fib -1 Nat Nat norm -1,-2 Nat Nat map y λ(x)e

35 TPD Pycket Gradualtalk Typed Racket H E 1

36 TPD Pycket Gradualtalk Typed Racket H 1 E mypy Flow Hack Pyre Pytype rtc Strongtalk TypeScript Typed Clojure Typed Lua Dart 1

37 TPD Pycket Gradualtalk Typed Racket H 1 E mypy Flow Hack Pyre Pytype rtc Strongtalk TypeScript Typed Clojure Typed Lua Dart 1

38 first-order 1 Nat fib -1 Nat Nat norm -1,-2 Nat Nat map y λ(x)e

39 TPD Pycket Gradualtalk Typed Racket H 1 E mypy Flow Hack Pyre Pytype rtc Strongtalk TypeScript Typed Clojure Typed Lua Dart 1

40 TPD Pycket Gradualtalk Typed Racket H Reticulated 1 E mypy Flow Hack Pyre Pytype rtc Strongtalk TypeScript Typed Clojure Typed Lua Dart 1

41 TPD mypy Pycket Gradualtalk Typed Racket H Flow Hack Pyre E Pytype rtc Strongtalk SafeTS* Dart 2* Reticulated Pallene 1 TypeScript Typed Clojure Nom* Grace Typed Lua Dart 1

42 TPD mypy Pycket Gradualtalk Typed Racket H StrongScript* Flow Hack Pyre Pyret E Pytype rtc Strongtalk SafeTS* Dart 2* Reticulated Pallene 1 Thorn* TypeScript Typed Clojure Nom* Grace Typed Lua Dart 1

43 Is type soundness all-or-nothing?

44 H E 1 Same type soundness?

45 Same type soundness? No! H E 1

46 - H e:t sound for H - E e sound for E H E 1-1 e:k(t) sound for 1 H e:t E e 1 e:k(t)

47 Implementation

48 H E 1 H E 1

49 H E 1

50 H E 1 expand typecheck enforce t optimize

51 H E 1 expand expand typecheck typecheck enforce t erase t optimize

52 H E 1 expand expand expand typecheck typecheck typecheck enforce t erase t enforce K(t) optimize

53 H E 1 expand expand expand typecheck typecheck typecheck enforce t erase t enforce K(t) optimize Optimize?

54 Experiment

55 - 10 benchmark programs - 2 to 10 modules each - 4 to 1024 configurations each - compare overhead to untyped docs.racket-lang.org/gtp-benchmarks

56 Results

57 Typical program Overhead vs. Untyped Num. Type Annotations

58 Typical program Overhead vs. Untyped H E 1 higher-order erasure first-order Num. Type Annotations

59

60 Implications

61 Theory Implications H progress + preserves types H 1 E E progress 1 progress + preserves type constructors

62 Theory Implications H progress + preserves types H 1 E E progress 1 progress + preserves type constructors - H refines 1-1 refines E

63 Performance Implications H add types to 'packages' E add types anywhere 1 add types sparingly Overhead vs. Untyped Num. Type Annotations

64

65 higher-order H Nat fib -1 Nat Nat norm -1,-2 Nat Nat map y λ(x)e

66 erasure E Nat fib -1 Nat Nat norm -1,-2 Nat Nat map y λ(x)e

67 first-order 1 Nat fib -1 Nat Nat norm -1,-2 Nat Nat map y λ(x)e

68 TPD mypy Pycket Gradualtalk Typed Racket H StrongScript* Flow Hack Pyre Pyret E Pytype rtc Strongtalk SafeTS* Dart 2* Reticulated Pallene 1 Thorn* TypeScript Typed Clojure Nom* Grace Typed Lua Dart 1

69

70 Is type soundness all-or-nothing? What invariants should the language guarantee? Can adding types slow down a program? Yes, through interaction with untyped code (or data)

A Spectrum of Type Soundness and Performance

A Spectrum of Type Soundness and Performance A Spectrum of Type Soundness and Performance BEN GREENMAN, PLT @ Northeastern University, USA MATTHIAS FELLEISEN, PLT @ Northeastern University, USA The literature on gradual typing presents three fundamentally

More information

2 Blending static and dynamic typing

2 Blending static and dynamic typing 2 Blending static and dynamic typing We begin this chapter presenting a little bit of the history behind combining static and dynamic typing in the same language. Then, we introduce optional type systems

More information

CMSC 631 Program Analysis and Understanding. Dynamic Typing, Contracts, and Gradual Typing

CMSC 631 Program Analysis and Understanding. Dynamic Typing, Contracts, and Gradual Typing CMSC 631 Program Analysis and Understanding Dynamic Typing, Contracts, and Gradual Typing Static vs. Dynamic Typing Languages with Static Typing Examples: Ocaml, Java, C#, Scala, Haskell Typechecker proves

More information

Dependent types and program equivalence. Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg

Dependent types and program equivalence. Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg Dependent types and program equivalence Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg Doing dependent types wrong without going wrong Stephanie Weirich,

More information

The Trouble with Types

The Trouble with Types The Trouble with Types Martin Odersky EPFL and Typesafe Types Everyone has an opinion on them Industry: Used to be the norm (C/C++, Java). Today split about evenly with dynamic. Academia: Static types

More information

Sound Gradual Typing is Nominally Alive and Well

Sound Gradual Typing is Nominally Alive and Well Sound Gradual Typing is Nominally Alive and Well FABIAN MUEHLBOECK, Cornell University, USA ROSS TATE, Cornell University, USA Recent research has identified significant performance hurdles that sound

More information

A Practical Optional Type System for Clojure. Ambrose Bonnaire-Sergeant

A Practical Optional Type System for Clojure. Ambrose Bonnaire-Sergeant A Practical Optional Type System for Clojure Ambrose Bonnaire-Sergeant Statically typed vs. Dynamically typed Traditional distinction Dynamically typed Statically typed eg. Java, C, Haskell eg. Javascript,

More information

Design and Evaluation of Gradual Typing for Python

Design and Evaluation of Gradual Typing for Python Design and Evaluation of Gradual Typing for Python Michael M. Vitousek Andrew M. Kent Jeremy G. Siek Jim Baker Indiana University Bloomington Rackspace, Inc. October 21, 2014 1 / 18 Gradual typing def

More information

Typed Lambda Calculus and Exception Handling

Typed Lambda Calculus and Exception Handling Typed Lambda Calculus and Exception Handling Dan Zingaro zingard@mcmaster.ca McMaster University Typed Lambda Calculus and Exception Handling p. 1/2 Untyped Lambda Calculus Goal is to introduce typing

More information

Dependent types and program equivalence. Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg

Dependent types and program equivalence. Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg Dependent types and program equivalence Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg What are dependent types? Types that depend on values of other types

More information

The gradual typing approach to mixing static and dynamic typing

The gradual typing approach to mixing static and dynamic typing 1 / 38 The gradual typing approach to mixing static and dynamic typing Jeremy G. Siek University of Colorado = Indiana University TFP 2013 at Provo, Utah, May 2013 The Goals of Gradual Typing Enjoy the

More information

Tradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness?

Tradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness? Tradeoffs CSE 505: Programming Languages Lecture 15 Subtyping Zach Tatlock Autumn 2017 Desirable type system properties (desiderata): soundness - exclude all programs that get stuck completeness - include

More information

Thesis Proposal: Typed Clojure in Theory and Practice

Thesis Proposal: Typed Clojure in Theory and Practice Thesis Proposal: Typed Clojure in Theory and Practice Ambrose Bonnaire-Sergeant August 13, 2018 Abstract We present Typed Clojure, an optional type system for the Clojure programming language. This thesis

More information

TYPES ARE LIKE THE WEATHER, TYPE SYSTEMS ARE LIKE WEATHERMEN MATTHIAS FELLEISEN, RACKETEER

TYPES ARE LIKE THE WEATHER, TYPE SYSTEMS ARE LIKE WEATHERMEN MATTHIAS FELLEISEN, RACKETEER TYPES ARE LIKE THE WEATHER, TYPE SYSTEMS ARE LIKE WEATHERMEN MATTHIAS FELLEISEN, RACKETEER TYPES @ STRANGE LOOP Types Types Mr. Misunderstood MY OWN PATH TO APPRECIATION 1978 Algol 60, Simula 67, Pascal,

More information

Concrete Types for TypeScript

Concrete Types for TypeScript Concrete Types for TypeScript Gregor Richards 1, Francesco Zappa Nardelli 2, and Jan Vitek 3 1 University of Waterloo 2 Inria 3 Northeastern University Abstract TypeScript extends JavaScript with optional

More information

The Future of Programming Languages. Will Crichton CS /28/18

The Future of Programming Languages. Will Crichton CS /28/18 The Future of Programming Languages Will Crichton CS 242 11/28/18 Thesis: The future of performance optimization is better programming models, not better optimizers. Thesis: programming languages The future

More information

Concrete Types for TypeScript

Concrete Types for TypeScript Concrete Types for TypeScript Gregor Richards 1, Francesco Zappa Nardelli 2, and Jan Vitek 3 1 University of Waterloo, Canada 2 Inria, France 3 Northeastern University, USA Abstract TypeScript extends

More information

CSC324 Principles of Programming Languages

CSC324 Principles of Programming Languages CSC324 Principles of Programming Languages http://mcs.utm.utoronto.ca/~324 November 14, 2018 Today Final chapter of the course! Types and type systems Haskell s type system Types Terminology Type: set

More information

Cast Insertion Strategies for Gradually-Typed Objects

Cast Insertion Strategies for Gradually-Typed Objects Cast Insertion Strategies for Gradually-Typed Objects Esteban Allende Johan Fabry Éric Tanter PLEIAD Laboratory Computer Science Department (DCC) University of Chile {eallende,jfabry,etanter}@dcc.uchile.cl

More information

` e : T. Gradual Typing. ` e X. Ronald Garcia University of British Columbia

` e : T. Gradual Typing. ` e X. Ronald Garcia University of British Columbia aaab/hicbvbns8naen34wetxtecvi0xwvbirfe9fd3qs0c9oqplsnu3s3stsbgqh1l/ixymixv0h3vw3btsctpxbwoo9gwbmbslnsjvot7w2vrg5tv3ake/u7r8c2kfhbzvkktawsxgiuweoyllmw5pptruppcactjvb6g7md8zukpbetz2n1bcwifnecggj9e2kdw9capbgiaghpvggn/t21ak5c+bv4hakigo0+vaxfyykeztwhinspddjtt8bqrnhdfr2mkvticmy0j6hmqiq/mn8+ck+m0qio0saijweq78njicuykvgogxoovr2zuj/xi/t0bu/yxgaarqtxaio41gnejyedpmkrppceccsmvsxgyieok1ezrocu/zykmlf1fyn5j5evuu3rrwldijo0tly0rwqowfuqc1eui6e0st6s56sf+vd+li0rlnftax9gfx5a8zmk40=

More information

Like Types. aka. integrating typed and untyped code in Thorn. Francesco Zappa Nardelli. INRIA Paris-Rocquencourt, MOSCOVA research team

Like Types. aka. integrating typed and untyped code in Thorn. Francesco Zappa Nardelli. INRIA Paris-Rocquencourt, MOSCOVA research team Like Types aka. integrating typed and untyped code in Thorn Francesco Zappa Nardelli INRIA Paris-Rocquencourt, MOSCOVA research team Tobias Wrigstad Sylvain Lebresne Johan Östlund Jan Vitek Purdue University

More information

Refinement Types for TypeScript

Refinement Types for TypeScript Refinement Types for TypeScript Panagiotis Vekris Benjamin Cosman Ranjit Jhala University of California, San Diego PLDI 16 Thursday, June 16 Extensible static analyses for modern scripting languages 2

More information

Towards An Adaptive Framework for Performance Portability

Towards An Adaptive Framework for Performance Portability Towards An Adaptive Framework for Performance Portability Work in Progress (submission #23) Patrick Maier Magnus Morton Phil Trinder School of Computing Science University of Glasgow IFL 25 Maier, Morton,

More information

Goal. CS152: Programming Languages. Lecture 15 Parametric Polymorphism. What the Library Likes. What The Client Likes. Start simpler.

Goal. CS152: Programming Languages. Lecture 15 Parametric Polymorphism. What the Library Likes. What The Client Likes. Start simpler. Goal Understand what this interface means and why it matters: CS152: Programming Languages Lecture 15 Parametric Polymorphism Dan Grossman Spring 2011 type a mylist; val mt_list : a mylist val cons : a

More information

Migratory Typing: Ten Years Later

Migratory Typing: Ten Years Later Migratory Typing: Ten Years Later Sam Tobin-Hochstadt, Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Ben Greenman, Andrew M. Kent, Vincent St-Amour, T. Stephen Strickland, Asumu Takikawa 1 1

More information

Simple Unification-based Type Inference for GADTs

Simple Unification-based Type Inference for GADTs Simple Unification-based Type Inference for GADTs Stephanie Weirich University of Pennsylvania joint work with Dimitrios Vytiniotis, Simon Peyton Jones and Geoffrey Washburn Overview Goal: Add GADTs to

More information

Transparent Object Proxies for JavaScript

Transparent Object Proxies for JavaScript Transparent Object Proxies for JavaScript Matthias Keil 1, Omer Farooq 1, Sankha Narayan Guria 2, Andreas Schlegel 1, Manuel Geffken 1, Peter Thiemann 1 1 University of Freiburg, Germany, 2 Indian Institute

More information

Tracing Ambiguity in GADT Type Inference

Tracing Ambiguity in GADT Type Inference Tracing Ambiguity in GADT Type Inference ML Workshop 2012, Copenhagen Jacques Garrigue & Didier Rémy Nagoya University / INRIA Garrigue & Rémy Tracing ambiguity 1 Generalized Algebraic Datatypes Algebraic

More information

CSE-321 Programming Languages 2010 Final

CSE-321 Programming Languages 2010 Final Name: Hemos ID: CSE-321 Programming Languages 2010 Final Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 18 28 16 12 36 40 150 There are six problems on 16 pages, including two work sheets, in

More information

Recitation 8: Dynamic and Unityped Languages : Foundations of Programming Languages

Recitation 8: Dynamic and Unityped Languages : Foundations of Programming Languages Recitation 8: Dynamic and Unityped Languages 15-312: Foundations of Programming Languages Jeanne Luning Prak, Charles Yuan March 7, 2018 1 Untyped Languages In this recitation, we explore two languages:

More information

Jam: A Smooth Extension With Java Mixins

Jam: A Smooth Extension With Java Mixins Jam: A Smooth Extension With Java Mixins Davide Ancona, Giovanni Lagorio, Ellena Zucca Presentation created by Left-out Jam abstract syntax Formal definitions of Jam static semantics Formal definitions

More information

Confined Gradual Typing

Confined Gradual Typing Confined Gradual Typing Extended version with detailed proofs Esteban Allende 1 Johan Fabry 1 Ronald Garcia 2 Éric Tanter 1 1 PLEIAD Laboratory, Computer Science Department (DCC), University of Chile,

More information

Languages as Libraries

Languages as Libraries Languages as Libraries or, implementing the next 700 programming languages Sam Tobin-Hochstadt Vincent St-Amour Ryan Culpepper Matthew Flatt Matthias Felleisen PLT @ Northeastern & Utah June 6, 2011 PLDI

More information

Lecture 4 Memory Management

Lecture 4 Memory Management Lecture 4 Memory Management Dr. Wilson Rivera ICOM 4036: Programming Languages Electrical and Computer Engineering Department University of Puerto Rico Some slides adapted from Sebesta s textbook Lecture

More information

Confined Gradual Typing

Confined Gradual Typing Confined Gradual Typing Esteban Allende 1 Johan Fabry 1 Ronald Garcia 2 Éric Tanter 1 1 PLEIAD Laboratory, Computer Science Department (DCC), University of Chile, Chile 2 Software Practices Laboratory,

More information

How to Evaluate the Performance of Gradual Type Systems

How to Evaluate the Performance of Gradual Type Systems Under consideration for publication in J. Functional Programming 1 How to Evaluate the Performance of Gradual Type Systems BEN GREENMAN 1 ASUMU TAKIKAWA 1 MAX S. NEW 1 DANIEL FELTEY 2 ROBERT BRUCE FINDLER

More information

THE DESIGN, IMPLEMENTATION, AND EVALUATION OF A GRADUAL TYPE SYSTEM FOR DYNAMIC CLASS COMPOSITION

THE DESIGN, IMPLEMENTATION, AND EVALUATION OF A GRADUAL TYPE SYSTEM FOR DYNAMIC CLASS COMPOSITION THE DESIGN, IMPLEMENTATION, AND EVALUATION OF A GRADUAL TYPE SYSTEM FOR DYNAMIC CLASS COMPOSITION Submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy College of

More information

Interlanguage Migration

Interlanguage Migration Interlanguage Migration From Scripts to Programs Sam Tobin-Hochstadt and Matthias Felleisen Northeastern University DLS 2006 1 A Story 2 About a programmer 3 Who needed to manage his budget 4 And so, he

More information

1 Introduction. 3 Syntax

1 Introduction. 3 Syntax CS 6110 S18 Lecture 19 Typed λ-calculus 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic semantics,

More information

Consistent Subtyping for All

Consistent Subtyping for All Consistent Subtyping for All Ningning Xie Xuan Bi Bruno C. d. S. Oliveira 11 May, 2018 The University of Hong Kong 1 Background There has been ongoing debate about which language paradigm, static typing

More information

Verifying Program Invariants with Refinement Types

Verifying Program Invariants with Refinement Types Verifying Program Invariants with Refinement Types Rowan Davies and Frank Pfenning Carnegie Mellon University Princeton and Yale Colloquium Talks February, 2001 Acknowledgments: Robert Harper 1 Overview

More information

Programming Languages

Programming Languages CSE 230: Winter 2008 Principles of Programming Languages Ocaml/HW #3 Q-A Session Push deadline = Mar 10 Session Mon 3pm? Lecture 15: Type Systems Ranjit Jhala UC San Diego Why Typed Languages? Development

More information

Subtyping. Lecture 13 CS 565 3/27/06

Subtyping. Lecture 13 CS 565 3/27/06 Subtyping Lecture 13 CS 565 3/27/06 Polymorphism Different varieties of polymorphism: Parametric (ML) type variables are abstract, and used to encode the fact that the same term can be used in many different

More information

At build time, not application time. Types serve as statically checkable invariants.

At build time, not application time. Types serve as statically checkable invariants. Static Typing Thus far we have only considered statically typed languages. CMPSCI 630: Programming Languages Static and Dynamic Typing Spring 2008 (with thanks to Robert Harper) Type system is based on

More information

Combining Proofs and Programs in a Dependently Typed Language. Certification of High-level and Low-level Programs

Combining Proofs and Programs in a Dependently Typed Language. Certification of High-level and Low-level Programs Combining Proofs and Programs in a Dependently Typed Language Stephanie Weirich University of Pennsylvania July 7, 2014 Certification of High-level and Low-level Programs Zombie A functional programming

More information

Refinement Types as Proof Irrelevance. William Lovas with Frank Pfenning

Refinement Types as Proof Irrelevance. William Lovas with Frank Pfenning Refinement Types as Proof Irrelevance William Lovas with Frank Pfenning Overview Refinement types sharpen existing type systems without complicating their metatheory Subset interpretation soundly and completely

More information

Subtyping (cont) Lecture 15 CS 565 4/3/08

Subtyping (cont) Lecture 15 CS 565 4/3/08 Subtyping (cont) Lecture 15 CS 565 4/3/08 Formalization of Subtyping Inversion of the subtype relation: If σ

More information

Refined Criteria for Gradual Typing

Refined Criteria for Gradual Typing Refined Criteria for Gradual Typing Jeremy G. Siek 1, Michael M. Vitousek 1, Matteo Cimini 1, and John Tang Boyland 2 1 Indiana University Bloomington, School of Informatics and Computing 150 S. Woodlawn

More information

Programming Languages Lecture 14: Sum, Product, Recursive Types

Programming Languages Lecture 14: Sum, Product, Recursive Types CSE 230: Winter 200 Principles of Programming Languages Lecture 4: Sum, Product, Recursive Types The end is nigh HW 3 No HW 4 (= Final) Project (Meeting + Talk) Ranjit Jhala UC San Diego Recap Goal: Relate

More information

Official Survey. Cunning Plan: Focus On Objects. The Need for a Calculus. Object Calculi Summary. Why Not Use λ-calculus for OO?

Official Survey. Cunning Plan: Focus On Objects. The Need for a Calculus. Object Calculi Summary. Why Not Use λ-calculus for OO? Modeling and Understanding Object-Oriented Oriented Programming Official Survey Please fill out the Toolkit course survey 40142 CS 655-1 Apr-21-2006 Midnight May-04-2006 9am Why not do it this evening?

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 1 Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Use currying

More information

Functional Programming

Functional Programming The Meta Language (ML) and Functional Programming Daniel S. Fava danielsf@ifi.uio.no Department of informatics University of Oslo, Norway Motivation ML Demo Which programming languages are functional?

More information

What if Type Systems were more like Linters?

What if Type Systems were more like Linters? Typed Clojure An optional type system for Clojure What if Type Systems were more like Linters? Ambrose Bonnaire-Sergeant Me A Practical Optional Type System for Clojure (2012) Typed Clojure Indiegogo Campaign

More information

Big Bang. Designing a Statically Typed Scripting Language. Pottayil Harisanker Menon, Zachary Palmer, Scott F. Smith, Alexander Rozenshteyn

Big Bang. Designing a Statically Typed Scripting Language. Pottayil Harisanker Menon, Zachary Palmer, Scott F. Smith, Alexander Rozenshteyn Big Bang Designing a Statically Typed Scripting Language Pottayil Harisanker Menon, Zachary Palmer, Scott F. Smith, Alexander Rozenshteyn The Johns Hopkins University June 11, 2012 Scripting Languages!

More information

Exercise 11 Ownership Types and Non-null Types December 8, 2017

Exercise 11 Ownership Types and Non-null Types December 8, 2017 Concepts of Object-Oriented Programming AS 2017 Exercise 11 Ownership Types and Non-null Types December 8, 2017 Task 1 Consider the following method signatures: peer Object foo(any String el); peer Object

More information

TRELLYS and Beyond: Type Systems for Advanced Functional Programming

TRELLYS and Beyond: Type Systems for Advanced Functional Programming TRELLYS and Beyond: Type Systems for Advanced Functional Programming Aaron Stump Computer Science The University of Iowa Joint work with Tim Sheard, Vilhelm Sjöberg, and Stephanie Weirich. Supported by

More information

The Typed Racket Guide

The Typed Racket Guide The Typed Racket Guide Version 5.3.6 Sam Tobin-Hochstadt and Vincent St-Amour August 9, 2013 Typed Racket is a family of languages, each of which enforce

More information

CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011

CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011 CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic

More information

COS 320. Compiling Techniques

COS 320. Compiling Techniques Topic 5: Types COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer 1 Types: potential benefits (I) 2 For programmers: help to eliminate common programming mistakes, particularly

More information

Interlanguage Migration: From Scripts to Programs

Interlanguage Migration: From Scripts to Programs Interlanguage Migration: From Scripts to Programs Sam Tobin-Hochstadt Northeastern University Boston, MA samth@ccs.neu.edu Matthias Felleisen Northeastern University Boston, MA matthias@ccs.neu.edu ABSTRACT

More information

Practical Optional Types for Clojure

Practical Optional Types for Clojure Practical Optional Types for Clojure Ambrose Bonnaire-Sergeant, Rowan Davies*, Sam Tobin-Hochstadt Indiana University ; Omnia Team, Commonwealth Bank of Australia* {abonnair,samth}@indiana.edu, Rowan.Davies@cba.com.au

More information

Programming Languages Lecture 15: Recursive Types & Subtyping

Programming Languages Lecture 15: Recursive Types & Subtyping CSE 230: Winter 2008 Principles of Programming Languages Lecture 15: Recursive Types & Subtyping Ranjit Jhala UC San Diego News? Formalize first-order type systems Simple types (integers and booleans)

More information

Recursive Types and Subtyping

Recursive Types and Subtyping Recursive Types and Subtyping #1 One-Slide Summary Recall: Recursive types (e.g., τ list) make the typed lambda calculus as powerful as the untyped lambda calculus. If τ is a subtype of σ then any expression

More information

Assertions, pre/postconditions

Assertions, pre/postconditions Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What

More information

Linking Types: Secure compilation of multi-language programs

Linking Types: Secure compilation of multi-language programs Linking Types: Secure compilation of multi-language programs Daniel Patterson and Amal Ahmed January 15, 2017 Northeastern University Fully abstract compilers Source program fully abstract compiler Compiled

More information

Programming Up-to-Congruence, Again. WG 2.8 Estes Park

Programming Up-to-Congruence, Again. WG 2.8 Estes Park Programming Up-to-Congruence, Again Stephanie Weirich University of Pennsylvania August 12, 2014 WG 2.8 Estes Park Zombie A functional programming language with a dependent type system intended for lightweight

More information

Verifying Java Programs Verifying Java Programs with KeY

Verifying Java Programs Verifying Java Programs with KeY Verifying Java Programs Verifying Java Programs with KeY Wolfgang Schreiner Wolfgang.Schreiner@risc.jku.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.jku.at

More information

Modern Stored Procedures Using GraalVM

Modern Stored Procedures Using GraalVM Modern Stored Procedures Using raalvm Oracle Labs Matthias Brantner Safe Harbor Statement The following is intended to outline our general product direction. t is intended

More information

Typed Racket: Racket with Static Types

Typed Racket: Racket with Static Types Typed Racket: Racket with Static Types Version 5.0.2 Sam Tobin-Hochstadt November 6, 2010 Typed Racket is a family of languages, each of which enforce that programs written in the language obey a type

More information

Alonzo a Compiler for Agda

Alonzo a Compiler for Agda Alonzo a Compiler for Agda Marcin Benke Institute of Informatics, Warsaw University, ben@mimuw.edu.pl 1 Introduction Agda [Norell, 2007] is an interactive system for developing constructive proofs in a

More information

Gradual Typing with Union and Intersection Types

Gradual Typing with Union and Intersection Types Gradual Typing with Union and Intersection Types Giuseppe Castagna, Victor Lanvin ICFP 17 September 6, 2017 1 / 14 Outline 1 Motivating Example 2 Types and Subtyping 3 Function Types and Operators 4 Conclusion

More information

Search for Program Structure

Search for Program Structure Gabriel Scherer 2017-9999: Parsifal, INRIA Saclay 2016-2017: Northeastern University with Amal Ahmed 2012-2015: Gallium, INRIA Rocquencourt with Didier Rémy Search for Program Structure 1 The Unreasonable

More information

Lecture 14: Recursive Types

Lecture 14: Recursive Types Lecture 14: Recursive Types Polyvios Pratikakis Computer Science Department, University of Crete Type Systems and Programming Languages Pratikakis (CSD) Recursive Types CS546, 2018-2019 1 / 11 Motivation

More information

Gradual Typing for Smalltalk

Gradual Typing for Smalltalk Gradual Typing for Smalltalk Esteban Allende a,, Oscar Callaú a, Johan Fabry a, Éric Tantera, Marcus Denker b a PLEIAD Laboratory Computer Science Department (DCC) University of Chile b INRIA Lille Nord

More information

Lesson 4 Typed Arithmetic Typed Lambda Calculus

Lesson 4 Typed Arithmetic Typed Lambda Calculus Lesson 4 Typed Arithmetic Typed Lambda 1/28/03 Chapters 8, 9, 10 Outline Types for Arithmetic types the typing relation safety = progress + preservation The simply typed lambda calculus Function types

More information

Type Systems. Today. 1. Organizational Matters. 1. Organizational Matters. Lecture 1 Oct. 20th, 2004 Sebastian Maneth. 1. Organizational Matters

Type Systems. Today. 1. Organizational Matters. 1. Organizational Matters. Lecture 1 Oct. 20th, 2004 Sebastian Maneth. 1. Organizational Matters Today Type Systems 1. Organizational Matters 2. What is this course about? 3. Where do types come from? 4. Def. of the small language Expr. Its syntax and semantics. Lecture 1 Oct. 20th, 2004 Sebastian

More information

Subtyping (cont) Formalization of Subtyping. Lecture 15 CS 565. Inversion of the subtype relation:

Subtyping (cont) Formalization of Subtyping. Lecture 15 CS 565. Inversion of the subtype relation: Subtyping (cont) Lecture 15 CS 565 Formalization of Subtyping Inversion of the subtype relation:! If "

More information

Experimental New Directions for JavaScript

Experimental New Directions for JavaScript Experimental New Directions for JavaScript Andreas Rossberg, V8/Google Motivation Broad need for (more) scalable JavaScript Usability, esp. maintainability Performance, esp. predictability ES6 opens up

More information

CSCE 314 Programming Languages. Type System

CSCE 314 Programming Languages. Type System CSCE 314 Programming Languages Type System Dr. Hyunyoung Lee 1 Names Names refer to different kinds of entities in programs, such as variables, functions, classes, templates, modules,.... Names can be

More information

C# Generics. Object Oriented Programming (236703) Winter

C# Generics. Object Oriented Programming (236703) Winter C# Generics Object Oriented Programming (236703) Winter 2014-5 C# Generics in a nutshell Outline Generics what is it good for? C# generics semantics Generics and reflection Limitations Variance 2 Why Do

More information

Dynamically-typed Languages. David Miller

Dynamically-typed Languages. David Miller Dynamically-typed Languages David Miller Dynamically-typed Language Everything is a value No type declarations Examples of dynamically-typed languages APL, Io, JavaScript, Lisp, Lua, Objective-C, Perl,

More information

An Approach to Behavioral Subtyping Based on Static Analysis

An Approach to Behavioral Subtyping Based on Static Analysis TACoS 04 Preliminary Version An Approach to Behavioral Subtyping Based on Static Analysis Francesco Logozzo 1 STIX - École Polytechnique F-91128 Palaiseau, France Abstract In mainstream object oriented

More information

Recursive Types and Subtyping

Recursive Types and Subtyping Recursive Types and Subtyping #1 One-Slide Summary Recursive types (e.g., list) make the typed lambda calculus as powerful as the untyped lambda calculus. If is a subtype of then any expression of type

More information

Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples

Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Introduction to Typed Racket The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples Getting started Find a machine with DrRacket installed (e.g. the

More information

CMSC330. Objects, Functional Programming, and lambda calculus

CMSC330. Objects, Functional Programming, and lambda calculus CMSC330 Objects, Functional Programming, and lambda calculus 1 OOP vs. FP Object-oriented programming (OOP) Computation as interactions between objects Objects encapsulate mutable data (state) Accessed

More information

CSolve: Verifying C With Liquid Types

CSolve: Verifying C With Liquid Types CSolve: Verifying C With Liquid Types Patrick Rondon, Alexander Bakst, Ming Kawaguchi, and Ranjit Jhala University of California, San Diego {prondon, abakst, mwookawa, jhala@cs.ucsd.edu Abstract. We present

More information

GRADUAL TYPING FOR FIRST-CLASS MODULES

GRADUAL TYPING FOR FIRST-CLASS MODULES GRADUAL TYPING FOR FIRST-CLASS MODULES Daniel Feltey Submitted in partial fulfillment of the requirements for the degree of Master of Science Department of Computer Science Northeastern University Boston,

More information

3 Type Inference and Optimization

3 Type Inference and Optimization 3 Type Inference and Optimization The previous chapter presented a basic compiler from Lua to the CLR and some variations of it, changing the runtime representation of Lua values and the treatment of functions

More information

Capabilities for Uniqueness and Borrowing

Capabilities for Uniqueness and Borrowing Capabilities for Uniqueness and Borrowing Philipp Haller and Martin Odersky EPFL 24 th European Conference on Object Oriented Programming June 24, 2010 Maribor, Slovenia Motivating Example actor { val

More information

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) CSE 413 Languages & Implementation Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) 1 Goals Representing programs as data Racket structs as a better way to represent

More information

Lecture 7: Lists, Version 2 (with Mutation)

Lecture 7: Lists, Version 2 (with Mutation) Integrated Introduction to Computer Science Fisler Contents 1 The Impact of addfirst on Lists 1 2 The Challenge of Sharing Data Structures 2 2.1 Functional Lists in Memory................................

More information

ICS 252 Introduction to Computer Design

ICS 252 Introduction to Computer Design ICS 252 Introduction to Computer Design Lecture 3 Fall 2006 Eli Bozorgzadeh Computer Science Department-UCI System Model According to Abstraction level Architectural, logic and geometrical View Behavioral,

More information

Closed Types for a Safe Imperative MetaML

Closed Types for a Safe Imperative MetaML Under consideration for publication in J. Functional Programming 1 Closed Types for a Safe Imperative MetaML C. CALCAGNO, E. MOGGI, DISI, Univ. di Genova, Genova, Italy. (e-mail: {calcagno,moggi}@disi.unige.it)

More information

Reasoning About Programs Panagiotis Manolios

Reasoning About Programs Panagiotis Manolios Reasoning About Programs Panagiotis Manolios Northeastern University February 26, 2017 Version: 100 Copyright c 2017 by Panagiotis Manolios All rights reserved. We hereby grant permission for this publication

More information

Simon Peyton Jones Microsoft Research August 2013

Simon Peyton Jones Microsoft Research August 2013 Simon Peyton Jones Microsoft Research August 2013 reverse :: a. [a] -> [a] xs :: [Bool] foo :: [Bool] foo = reverse xs Instantiate reverse with a unification variable, standing for an as-yet-unknown type.

More information

Typed Assembly Language for Implementing OS Kernels in SMP/Multi-Core Environments with Interrupts

Typed Assembly Language for Implementing OS Kernels in SMP/Multi-Core Environments with Interrupts Typed Assembly Language for Implementing OS Kernels in SMP/Multi-Core Environments with Interrupts Toshiyuki Maeda and Akinori Yonezawa University of Tokyo Quiz [Environment] CPU: Intel Xeon X5570 (2.93GHz)

More information

Programming Language Features. CMSC 330: Organization of Programming Languages. Turing Completeness. Turing Machine.

Programming Language Features. CMSC 330: Organization of Programming Languages. Turing Completeness. Turing Machine. CMSC 330: Organization of Programming Languages Lambda Calculus Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying or tuples

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 1 Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying

More information

Rely-Guarantee References for Refinement Types over Aliased Mutable Data

Rely-Guarantee References for Refinement Types over Aliased Mutable Data Rely-Guarantee References for Refinement Types over Aliased Mutable Data Colin S. Gordon, Michael D. Ernst, and Dan Grossman University of Washington PLDI 2013 Static Verification Meets Aliasing 23 x:ref

More information

The Compiler So Far. Lexical analysis Detects inputs with illegal tokens. Overview of Semantic Analysis

The Compiler So Far. Lexical analysis Detects inputs with illegal tokens. Overview of Semantic Analysis The Compiler So Far Overview of Semantic Analysis Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Lexical analysis Detects inputs with illegal tokens Parsing Detects inputs with ill-formed

More information