A New Formalization of Subtyping to Match Subclasses to Subtypes
|
|
- Leslie Davidson
- 5 years ago
- Views:
Transcription
1 A New Formalization of Subtyping to Match Subclasses to Subtypes Hyunik Na and Sukyoung Ryu Programming Language Research Group KAIST June 6, 2014 Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 1/28
2 This Paper A New Formalization of Subtyping to Match Subclasses to Subtypes Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 2/28
3 Goal A New Formalization of Subtyping to Match Subclasses to Subtypes Subclassing class ColorPoint extends Point explicit by declarations easy for programmers Subtyping ColorPoint <: Point implicit by inference easy for type checkers Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 3/28
4 Goal A New Formalization of Subtyping to Match Subclasses to Subtypes Subclassing class ColorPoint extends Point explicit by declarations easy for programmers Subtyping ColorPoint <: Point implicit by inference easy for type checkers Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 3/28
5 Goal A New Formalization of Subtyping to Match Subclasses to Subtypes Subclassing class ColorPoint extends Point explicit by declarations easy for programmers Subtyping ColorPoint <: Point implicit by inference easy for type checkers Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 3/28
6 Solution A New Formalization of Subtyping to Match Subclasses to Subtypes Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 4/28
7 Motivation The self-type idiom in Fortress: trait Equality Self extends Equality Self abstract opr =(self, other : Self) : Boolean end This type Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 5/28
8 Motivation The self-type idiom in Fortress: trait Equality Self extends Equality Self abstract opr =(self, other : Self) : Boolean end This type Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 5/28
9 This Type in Practice Abstract domains for analyzing JavaScript programs Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 6/28
10 This Type in Practice Abstract domains for analyzing JavaScript programs SAFE: Scalable Analysis Framework for ECMAScript Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 7/28
11 This Type in Practice Abstract domains for analyzing JavaScript programs ˆv Value = PValue ( Loc) pv ˆ PValue = Ûndef Null Bool Number Ŝtring Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 8/28
12 This Type in Practice Abstract domains for analyzing JavaScript programs ˆv Value = PValue ( Loc) pv ˆ PValue = Ûndef Null Bool Number Ŝtring Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 9/28
13 This Type in Practice Abstract domains for analyzing JavaScript programs abstract class AbsBase { def istop(): Boolean def isbottom(): Boolean def isconcrete(): Boolean def toabsstring(): AbsString } Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 10/28
14 This Type in Practice Abstract domains for analyzing JavaScript programs sealed abstract class AbsNull extends AbsBase { /* partial order */ def <= (that: AbsNull) = {... } /* join */ def + (that: AbsNull) = {... } /* meet */ def <> (that: AbsNull) = {... } }... Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 11/28
15 This Type in Practice Abstract domains for analyzing JavaScript programs sealed abstract class AbsString extends AbsBase { /* partial order */ def <= (that: AbsString) = {... } /* join */ def + (that: AbsString) = {... } /* meet */ def <> (that: AbsString) = {... } }... Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 12/28
16 This Type in Practice Abstract domains for analyzing JavaScript programs abstract class AbsBase { /* partial order */ def <= (that: ThisType): Boolean } /* join */ def + (that: ThisType): ThisType /* meet */ def <> (that: ThisType): ThisType... Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 13/28
17 This Type in Practice Abstract domains for analyzing JavaScript programs Signatures of required methods in AbsBase Exact class matches at run time Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 14/28
18 This Type in Practice Abstract domains for analyzing JavaScript programs Signatures of required methods in AbsBase Exact class matches at run time Bruno Oliveira s solution abstract class AbsBase { type ThisType <: AbsBase def + (that: ThisType): ThisType... } case class AbsString extends AbsBase { type ThisType = AbsString override def + (that : ThisType): ThisType =... new AbsString()... } Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 15/28
19 This Type in Practice Abstract domains for analyzing JavaScript programs Signatures of required methods in AbsBase Exact class matches at run time Multiple implementations for one abstract domain abstract class AbsDomain {... } abstract class AbsBase[A] extends AbsDomain {... } class AbsString extends AbsBase[String] {... } class AbsStringSet extends AbsString {... } class AbsStringAutomata extends AbsString {... } Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 16/28
20 This Type in Practice Abstract domains for analyzing JavaScript programs Signatures of required methods in AbsBase Exact class matches at run time Multiple implementations for one abstract domain abstract class AbsDomain {... } abstract class AbsBase[A] extends AbsDomain {... } class AbsString extends AbsBase[String] {... } class AbsStringSet extends AbsString {... } class AbsStringAutomata extends AbsString {... } Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 16/28
21 This Type in Practice Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 17/28
22 This Type in Theory This-typed methods: owner types in their parameter types or return types abstract class AbsBase { /* partial order */ def <= (that: ThisType): Boolean } /* join */ def + (that: ThisType): ThisType /* meet */ def <> (that: ThisType): ThisType... Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 18/28
23 This Type in Theory This-typed methods: owner types in their parameter types or return types Traditional This type declared type of a receiver inexact compile-time type Our This type run-time type of a receiver exact run-time type not available but sayable at compile time Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 19/28
24 This Type in Theory This-typed methods: owner types in their parameter types or return types Traditional This type declared type of a receiver inexact compile-time type Our This type run-time type of a receiver exact run-time type not available but sayable at compile time Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 19/28
25 This Type in Calculus (TLDI 12) CoreThisJava, a formal core calculus to support the This type: new typing features exact class types of the form #C for a class C This type variable named wildcards of the form </X/> to describe more equality relationships between exact types exact type inference to lessen the programmers burden of using explicit annotations new language constructs virtual constructors to describe methods with ThisTyped results classesmatch to compare run-time types Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 20/28
26 This Type in Java (APLAS 13) ThisJava, an open-source implementation using JastAddJ: backward compatible compilation to Java bytecode practical interactions with existing Java features Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 21/28
27 This Type in Type System (FLOPS 14) Traditional subtyping cannot support subtyping by inheritance. class Point { int x; Point(int i) { this.x = i; } boolean equals(this other) { return this.x == other.x; } } class ColorPoint extends Point { int color; ColorPoint(int i, int c) { super(i); this.color = c; } boolean equals(this other) { return this.x == other.x && this.color == other.color; } } Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 22/28
28 This Type in Type System (FLOPS 14) Traditional subtyping cannot derive the following: µt.{x: int, c: int, eq: t bool } µt.{x: int, eq: t bool } New subtyping can derive the following: s < µt.{x: int, c: int, eq: t bool}.s <: s < µt.{x: int, eq: t bool}.s by distinguishing record types µt.{l i : τ i i 1..n } and some-record types s < µt.{l i : τ i i 1..n }.s explicitly Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 23/28
29 This Type in Type System (FLOPS 14) Traditional subtyping cannot derive the following: µt.{x: int, c: int, eq: t bool } µt.{x: int, eq: t bool } New subtyping can derive the following: s < µt.{x: int, c: int, eq: t bool}.s <: s < µt.{x: int, eq: t bool}.s by distinguishing record types µt.{l i : τ i i 1..n } and some-record types s < µt.{l i : τ i i 1..n }.s explicitly Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 23/28
30 This Type in Type System (FLOPS 14) Traditional subtyping cannot derive the following: µt.{x: int, c: int, eq: t bool } µt.{x: int, eq: t bool } New subtyping can derive the following: s < µt.{x: int, c: int, eq: t bool}.s <: s < µt.{x: int, eq: t bool}.s by distinguishing record types µt.{l i : τ i i 1..n } and some-record types s < µt.{l i : τ i i 1..n }.s explicitly Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 23/28
31 This Type in Type System (FLOPS 14) Record types µt.{l i : τ i i 1..n } types of run-time objects that have exactly those members l 1, l 2,..., l n exact run-time types Some-record types s < µt.{l i : τ i i 1..n }.s types of compile-time expressions that may evaluate to objects of record types specializing µt.{l i : τ i i 1..n } inexact compile-time types Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 24/28
32 This Type in Type System (FLOPS 14) Record types µt.{l i : τ i i 1..n } types of run-time objects that have exactly those members l 1, l 2,..., l n exact run-time types Some-record types s < µt.{l i : τ i i 1..n }.s types of compile-time expressions that may evaluate to objects of record types specializing µt.{l i : τ i i 1..n } inexact compile-time types Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 24/28
33 This Type in Type System (FLOPS 14) τ, υ ::= t ρ α γ τ τ type (revised) α, β ::= i µt.{l i : τ 1..n i } record type (revised) γ ::= s < α.s some-record type Specializing: α < β where ::= {t i i 1..n } [Specializing] n 0, m 0 t / i 1..n: {t} τ i <: υ i µt.{l i : τ i i 1..n+m } < µt.{l i : υ i i 1..n } Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 25/28
34 This Type in Type System (FLOPS 14) τ, υ ::= t ρ α γ τ τ type (revised) α, β ::= i µt.{l i : τ 1..n i } record type (revised) γ ::= s < α.s some-record type Specializing: α < β where ::= {t i i 1..n } [Specializing] n 0, m 0 t / i 1..n: {t} τ i <: υ i µt.{l i : τ i i 1..n+m } < µt.{l i : υ i i 1..n } Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 25/28
35 This Type in Type System (FLOPS 14) τ, υ ::= t ρ α γ τ τ type (revised) α, β ::= i µt.{l i : τ 1..n i } record type (revised) γ ::= s < α.s some-record type Revised subtyping: τ <: υ where ::= {t i i 1..n } [RS-Prim] ρ <: ρ [RS-Func] υ <: τ τ <: υ τ τ <: υ υ [RS-TVar] t t <: t [RS-RtoR] [RS-RtoS] [RS-StoS] α <: α α < β α <: s < β.s α < β s < α.s <: s < β.s Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 26/28
36 This Type in Type System (FLOPS 14) i Record types µt.{l i : τ 1..n i } i Some-record types s < µt.{l i : τ 1..n i }.s Revised subtyping [RS-RtoS] α < β α <: s < β.s [RS-StoS] α < β s < α.s <: s < β.s Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 27/28
37 Conclusion Supporting ThisTyped methods is an important real-world problem. Adding typing features and language constructs can support more ThisTyped methods. An open-source prototype implementation is available: Inheritance can be subtyping. s < µt.{x: int, c: int, eq: t bool}.s <: s < µt.{x: int, eq: t bool}.s Hyunik Na and Sukyoung Ryu A New Formalization of Subtyping to Match Subclasses to Subtypes 28/28
ERC 4th Workshop KAIST. Sukyoung Ryu KAIST. August 26, 2010
ERC 4th Workshop Sukyoung Ryu August 26, 2010 : Members Coq Mechanization of Basic Core Fortress for Type Soundness Adding Pattern Matching to Existing Object- Oriented Languages FortressCheck: Automatic
More informationExercise 3 Subtyping and Behavioral Subtyping October 13, 2017
Concepts of Object-Oriented Programming AS 2017 Exercise 3 Subtyping and Behavioral Subtyping October 13, 2017 Task 1 In this question, we are in a nominal subtyping setting. Some languages have a special
More informationLast name:... First name:... Department (if not D-INFK):...
Concepts of Object-Oriented Programming AS 2017 Concepts of Object-Oriented Programming Midterm Examination 10.11.2017 Prof. Dr. Peter Müller Last name:................................. First name:.................................
More informationA New Foundation for Generic Programming
Ord List A ) in The Implicit Calculus nt ) [[2, 5], [1, 3]] A New Foundation for Generic Programming 1 (presenter), Tom 2, Bruno C. d.{?(ord S.?(Ord Oliveira Schrijvers List Int with List Int )} List Int
More informationGeneric programming POLYMORPHISM 10/25/13
POLYMORPHISM Generic programming! Code reuse: an algorithm can be applicable to many objects! Goal is to avoid rewri:ng as much as possible! Example: int sqr(int i, int j) { return i*j; double sqr(double
More informationGADTs meet Subtyping
GADTs meet Subtyping Gabriel Scherer, Didier Rémy Gallium INRIA 2014 Gabriel Scherer, Didier Rémy (Gallium INRIA) GADTs meet Subtyping 2014 1 / 21 A reminder on GADTs GADTs are algebraic data types that
More informationOverview. Elements of Programming Languages. Objects. Self-Reference
Overview Elements of Programming Languages Lecture 10: James Cheney University of Edinburgh October 23, 2017 Last time: programming in the large Programs, packages/namespaces, importing Modules and interfaces
More informationLecture #23: Conversion and Type Inference
Lecture #23: Conversion and Type Inference Administrivia. Due date for Project #2 moved to midnight tonight. Midterm mean 20, median 21 (my expectation: 17.5). Last modified: Fri Oct 20 10:46:40 2006 CS164:
More informationFeatherweight Java (FJ)
x = 1 let x = 1 in... x(1).!x(1) x.set(1) Programming Language Theory Featherweight Java (FJ) Ralf Lämmel This lecture is based on David Walker s lecture: Computer Science 441, Programming Languages, Princeton
More informationChapter 14 Abstract Classes and Interfaces
Chapter 14 Abstract Classes and Interfaces 1 What is abstract class? Abstract class is just like other class, but it marks with abstract keyword. In abstract class, methods that we want to be overridden
More informationConversion vs. Subtyping. Lecture #23: Conversion and Type Inference. Integer Conversions. Conversions: Implicit vs. Explicit. Object x = "Hello";
Lecture #23: Conversion and Type Inference Administrivia. Due date for Project #2 moved to midnight tonight. Midterm mean 20, median 21 (my expectation: 17.5). In Java, this is legal: Object x = "Hello";
More informationHarvard School of Engineering and Applied Sciences Computer Science 152
Harvard School of Engineering and Applied Sciences Computer Science 152 Lecture 17 Tuesday, March 30, 2010 1 Polymorph means many forms. Polymorphism is the ability of code to be used on values of different
More informationObject Oriented Issues in VDM++
Object Oriented Issues in VDM++ Nick Battle, Fujitsu UK (nick.battle@uk.fujitsu.com) Background VDMJ implemented VDM-SL first (started late 2007) Formally defined. Very few semantic problems VDM++ support
More informationIntroducing Scala-like function types into Java-TX
Introducing Scala-like function types into Java-TX ManLang 2017 Martin Plümicke Andreas Stadelmeier www.dhbw-stuttgart.de/horb Overview 1 Type of lambda expressions in Java-8 2 Introducing real function
More informationSome instance messages and methods
Some instance messages and methods x ^x y ^y movedx: dx Dy: dy x
More informationPractice for Chapter 11
Practice for Chapter 11 MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) Object-oriented programming allows you to derive new classes from existing
More informationOverview. Elements of Programming Languages. Objects. Self-Reference
Overview Elements of Programming Languages Lecture 11: James Cheney University of Edinburgh November 3, 2015 Last time: programming in the large Programs, packages/namespaces, importing Modules and interfaces
More informationStatic type safety guarantees for the operators of a relational database querying system. Cédric Lavanchy
Static type safety guarantees for the operators of a relational database querying system Cédric Lavanchy June 6, 2008 Contents 1 Previous work 2 2 Goal 3 3 Theory bases 4 3.1 Typing a relation...........................
More informationCS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011
CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e
More informationParametric Polymorphism for Java: A Reflective Approach
Parametric Polymorphism for Java: A Reflective Approach By Jose H. Solorzano and Suad Alagic Presented by Matt Miller February 20, 2003 Outline Motivation Key Contributions Background Parametric Polymorphism
More informationObject Oriented Programming. Java-Lecture 11 Polymorphism
Object Oriented Programming Java-Lecture 11 Polymorphism Abstract Classes and Methods There will be a situation where you want to develop a design of a class which is common to many classes. Abstract class
More informationImplementing Higher-Level Languages. Quick tour of programming language implementation techniques. From the Java level to the C level.
Implementing Higher-Level Languages Quick tour of programming language implementation techniques. From the Java level to the C level. Ahead-of-time compiler compile time C source code C compiler x86 assembly
More informationThe Java Programming Language
The Java Programming Language Slide by John Mitchell (http://www.stanford.edu/class/cs242/slides/) Outline Language Overview History and design goals Classes and Inheritance Object features Encapsulation
More informationInheritance (cont.) Inheritance. Hierarchy of Classes. Inheritance (cont.)
Inheritance Inheritance (cont.) Object oriented systems allow new classes to be defined in terms of a previously defined class. All variables and methods of the previously defined class, called superclass,
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationTopic 9: Type Checking
Recommended Exercises and Readings Topic 9: Type Checking From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6 and
More informationTopic 9: Type Checking
Topic 9: Type Checking 1 Recommended Exercises and Readings From Haskell: The craft of functional programming (3 rd Ed.) Exercises: 13.17, 13.18, 13.19, 13.20, 13.21, 13.22 Readings: Chapter 13.5, 13.6
More informationObject typing and subtypes
CS 242 2012 Object typing and subtypes Reading Chapter 10, section 10.2.3 Chapter 11, sections 11.3.2 and 11.7 Chapter 12, section 12.4 Chapter 13, section 13.3 Subtyping and Inheritance Interface The
More informationLast name:... First name:... Department (if not D-INFK):...
Concepts of Object-Oriented Programming AS 2016 Concepts of Object-Oriented Programming Midterm Examination 11.11.2016 Prof. Dr. Peter Müller Last name:................................. First name:.................................
More informationCS-202 Introduction to Object Oriented Programming
CS-202 Introduction to Object Oriented Programming California State University, Los Angeles Computer Science Department Lecture III Inheritance and Polymorphism Introduction to Inheritance Introduction
More informationCOS 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 informationCompilers and computer architecture: Semantic analysis
1 / 1 Compilers and computer architecture: Semantic analysis Martin Berger Alex Jeffery October 2018 Recall the function of compilers 2 / 1 3 / 1 Recall the structure of compilers Source program Lexical
More informationModularizing constructors
Viviana Bono 1 Jarosław Kuśmierek 2 1 Torino University 2 Warsaw University TOOLS 2007 Zurich - 25 June 2007 Plan Problems 1 Problems Origins of the problems A Java example Existing approaches 2 3 The
More informationProgramming Paradigms, Fall 06
Programming Paradigms, Fall 06 Multiple Choice Exam January 29, 2007, 10:00 11:15 ID Name Each of the following questions has exactly one correct answer. For each question, you may select one or more answers
More informationUser-Defined Algebraic Data Types
72 Static Semantics User-Defined Types User-Defined Algebraic Data Types An algebraic data type declaration has the general form: data cx T α 1... α k = K 1 τ 11... τ 1k1... K n τ n1... τ nkn introduces
More informationCS111: PROGRAMMING LANGUAGE II
1 CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 4(b): Subclasses and Superclasses OOP OOP - Inheritance Inheritance represents the is a relationship between data types (e.g. student/person)
More informationExercise 6 Multiple Inheritance, Multiple Dispatch and Linearization November 3, 2017
Concepts of Object-Oriented Programming AS 2017 Exercise 6 Multiple Inheritance, Multiple Dispatch and Linearization November 3, 2017 Task 1 Consider the following C++ program: class X X(int p) : fx(p)
More informationSubtyping (Dynamic Polymorphism)
Fall 2018 Subtyping (Dynamic Polymorphism) Yu Zhang Course web site: http://staff.ustc.edu.cn/~yuzhang/tpl References PFPL - Chapter 24 Structural Subtyping - Chapter 27 Inheritance TAPL (pdf) - Chapter
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Week 13 - Part 1 Thomas Wies New York University Review Last lecture Object Oriented Programming Outline Today: Scala Sources: Programming in Scala, Second
More informationCS263: Runtime Systems Lecture: High-level language virtual machines
CS263: Runtime Systems Lecture: High-level language virtual machines Today: A Review of Object-oriented features Chandra Krintz UCSB Computer Science Department Virtual machines (VMs) Terminology Aka managed
More informationINHERITANCE. Spring 2019
INHERITANCE Spring 2019 INHERITANCE BASICS Inheritance is a technique that allows one class to be derived from another A derived class inherits all of the data and methods from the original class Suppose
More informationLate-bound Pragmatical Class Methods
Late-bound Pragmatical Class Methods AXEL SCHMOLITZKY, MARK EVERED, J. LESLIE KEEDY, GISELA MENGER Department of Computer Structures University of Ulm 89069 Ulm, Germany {axel, markev, keedy, gisela@informatik.uni-ulm.de
More informationThe design of a programming language for provably correct programs: success and failure
The design of a programming language for provably correct programs: success and failure Don Sannella Laboratory for Foundations of Computer Science School of Informatics, University of Edinburgh http://homepages.inf.ed.ac.uk/dts
More informationPrinciples of Programming Languages
Principles of Programming Languages Lesson 14 Type Checking Collaboration and Management Dana Fisman www.cs.bgu.ac.il/~ppl172 1 Type Checking We return to the issue of type safety we discussed informally,
More informationAgenda. Objects and classes Encapsulation and information hiding Documentation Packages
Preliminaries II 1 Agenda Objects and classes Encapsulation and information hiding Documentation Packages Inheritance Polymorphism Implementation of inheritance in Java Abstract classes Interfaces Generics
More informationChair of Software Engineering Java and C# in Depth
Chair of Software Engineering Java and C# in Depth Exercise Session Week 3 Agenda Ø Assignment I Review Ø Class Ini;aliza;on and Class Instance Crea;on Ø Quizzes Ø Assignment II Handout 2 Class Diagram
More informationProgramming 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 informationExercise 8 Parametric polymorphism November 18, 2016
Concepts of Object-Oriented Programming AS 2016 Exercise 8 Parametric polymorphism November 18, 2016 Task 1 Consider the following Scala classes: class A class B extends A class P1[+T] class P2[T
More informationProgramming 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 informationAdvanced features of Functional Programming (Haskell)
Advanced features of Functional Programming (Haskell) Polymorphism and overloading January 10, 2017 Monomorphic and polymorphic types A (data) type specifies a set of values. Examples: Bool: the type of
More informationObject-oriented Programming. Object-oriented Programming
2014-06-13 Object-oriented Programming Object-oriented Programming 2014-06-13 Object-oriented Programming 1 Object-oriented Languages object-based: language that supports objects class-based: language
More informationl e t print_name r = p r i n t _ e n d l i n e ( Name : ^ r. name)
Chapter 8 Row polymorphism Consider the following code: type name_home = {name : s t r i n g ; home : s t r i n g } type name_mobile = {name : s t r i n g ; mobile : s t r i n g } l e t jane = {name =
More informationObjects, Encapsulation, Inheritance (2)
CS 242 2012 Objects, Encapsulation, Inheritance (2) Reading (two lectures) Chapter 10, except section 10.4 Chapter 11, sections 11.1, 11.2, 11.3.1 and 11.4., 11.5, 11.6 only Chapter 12, sections 12.1,
More informationJava Primer 1: Types, Classes and Operators
Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,
More informationArgument Passing All primitive data types (int etc.) are passed by value and all reference types (arrays, strings, objects) are used through refs.
Local Variable Initialization Unlike instance vars, local vars must be initialized before they can be used. Eg. void mymethod() { int foo = 42; int bar; bar = bar + 1; //compile error bar = 99; bar = bar
More informationCSCI-GA Final Exam
CSCI-GA 2110-003 - Final Exam Instructor: Thomas Wies Name: Sample Solution ID: You have 110 minutes time. There are 7 assignments and you can reach 110 points in total. You can solve the exercises directly
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques (CIS120) Lecture 28 March 30, 2016 Collections and Equality Chapter 26 Announcements Dr. Steve Zdancewic is guest lecturing today He teaches CIS 120 in the Fall Midterm
More informationCOMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein
COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ 1 Last time... λ calculus syntax free variables, substitution β reduction α and η conversion
More informationIntroduction to System F. Lecture 18 CS 565 4/20/09
Introduction to System F Lecture 18 CS 565 4/20/09 The Limitations of F 1 (simply-typed λ- calculus) In F 1 each function works exactly for one type Example: the identity function id = λx:τ. x : τ τ We
More informationType Checking and Type Inference
Type Checking and Type Inference Principles of Programming Languages CSE 307 1 Types in Programming Languages 2 Static Type Checking 3 Polymorphic Type Inference Version: 1.8 17:20:56 2014/08/25 Compiled
More informationCSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Java Generics
1 CSCE 314: Programming Languages Dr. Flemming Andersen Java Generics 2 Detour: Rules for Method Overriding (1) CSCE 314 TAMU Fall 2017 1. The argument list should be exactly the same as that of the overridden
More informationA Certified Non-Interference Java Bytecode Verifier
1 A Certified Non-Interference Java Bytecode Verifier G. Barthe, D. Pichardie and T. Rezk, A Certified ightweight Non-Interference Java Bytecode Verifier, ESOP'07 2 Motivations 1: bytecode verification
More informationWeek 7. Statically-typed OO languages: C++ Closer look at subtyping
C++ & Subtyping Week 7 Statically-typed OO languages: C++ Closer look at subtyping Why talk about C++? C++ is an OO extension of C Efficiency and flexibility from C OO program organization from Simula
More informationJFlow: Practical Mostly-Static Information Flow Control
JFlow: Practical Mostly-Static Information Flow Control A.Myers and B.Liskov. A Decentralized Model for Information Flow Control (SOSP 1997). Andrew C. Myers and Barbara Liskov. Protecting privacy using
More informationClass, Variable, Constructor, Object, Method Questions
Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx
More informationPractical Mostly-Static Information Flow Control. Andrew Myers MIT Lab for Computer Science
Practical Mostly-Static Information Flow Control Andrew Myers MIT Lab for Computer Science Privacy Old problem (secrecy, confidentiality) : prevent programs from leaking data Untrusted, downloaded code:
More informationSimply-Typed Lambda Calculus
#1 Simply-Typed Lambda Calculus #2 Back to School What is operational semantics? When would you use contextual (small-step) semantics? What is denotational semantics? What is axiomatic semantics? What
More informationLecture 7: Type Systems and Symbol Tables. CS 540 George Mason University
Lecture 7: Type Systems and Symbol Tables CS 540 George Mason University Static Analysis Compilers examine code to find semantic problems. Easy: undeclared variables, tag matching Difficult: preventing
More informationOutline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring
Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,
More informationSelf Type Constructors. Atsushi Igarashi Kyoto University Joint work with Chieri Saito
Self Type Constructors Atsushi Igarashi Kyoto University Joint work with Chieri Saito 1 My Research Interests Type systems for static ananysis Linear types, resource usage analysis, etc. for object-oriented
More informationCMSC131. Inheritance. Object. When we talked about Object, I mentioned that all Java classes are "built" on top of that.
CMSC131 Inheritance Object When we talked about Object, I mentioned that all Java classes are "built" on top of that. This came up when talking about the Java standard equals operator: boolean equals(object
More informationType Declarations. Γ <num> : num [... <id> τ... ] <id> : τ Γ true : bool Γ false : bool Γ e 1 : num Γ e 2 : num Γ. {+ e 1 e 2 } : num
Type Declarations Γ : num [... τ... ] : τ Γ true : bool Γ false : bool Γ e 1 : num Γ e 2 : num Γ {+ e 1 e 2 } : num Γ e 1 : bool Γ e 2 : τ 0 Γ e 3 : τ 0 Γ {if e 1 e 2 e 3 } : τ 0 Γ[
More informationCompilation 2012 Static Type Checking
Compilation 2012 Jan Midtgaard Michael I. Schwartzbach Aarhus University The Type Checker The type checker has several tasks: determine the types of all expressions check that values and variables are
More informationGraphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub
Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java
More informationLecture #13: Type Inference and Unification. Typing In the Language ML. Type Inference. Doing Type Inference
Lecture #13: Type Inference and Unification Typing In the Language ML Examples from the language ML: fun map f [] = [] map f (a :: y) = (f a) :: (map f y) fun reduce f init [] = init reduce f init (a ::
More informationComputer Science 225 Advanced Programming Siena College Spring Topic Notes: Inheritance
Computer Science 225 Advanced Programming Siena College Spring 2017 Topic Notes: Inheritance Our next topic is another that is fundamental to object-oriented design: inheritance. Inheritance allows a programmer
More informationProgramming Languages Assignment #7
Programming Languages Assignment #7 December 2, 2007 1 Introduction This assignment has 20 points total. In this assignment, you will write a type-checker for the PolyMinML language (a language that is
More informationOBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe
OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++
More informationIntroduction to Object Oriented / Functional Programming 9. Object-Oriented Software Development COMP4001 CSE UNSW Sydney Lecturer: John Potter
Introduction to Object Oriented / Functional Programming 9 Object-Oriented Software Development COMP4001 CSE UNSW Sydney Lecturer: John Potter Lecture Outline object equality design patterns composite
More informationλ calculus is inconsistent
Content Rough timeline COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray λ Intro & motivation, getting started [1] Foundations & Principles
More informationFeatherweight Java. Lecture 12 CS 565 3/18/08
Featherweight Java Lecture 12 CS 565 3/18/08 Objects vs Functions Will start exploring an object model that treats objects and classes as primitives Avoids some of the complexities faced when encoding
More informationProgramming overview
Programming overview Basic Java A Java program consists of: One or more classes A class contains one or more methods A method contains program statements Each class in a separate file MyClass defined in
More informationWhat is Inheritance?
Inheritance 1 Agenda What is and Why Inheritance? How to derive a sub-class? Object class Constructor calling chain super keyword Overriding methods (most important) Hiding methods Hiding fields Type casting
More informationTyped Compilation Against Non-Manifest Base Classes
Typed Compilation Against Non-Manifest Base Classes Christopher League Long Island University christopher.league@liu.edu Stefan Monnier Université de Montréal monnier@iro.umontreal.ca FTfJP workshop 26
More informationCover Page. The handle holds various files of this Leiden University dissertation
Cover Page The handle http://hdl.handle.net/1887/22891 holds various files of this Leiden University dissertation Author: Gouw, Stijn de Title: Combining monitoring with run-time assertion checking Issue
More informationDeclarations and Access Control SCJP tips
Declarations and Access Control www.techfaq360.com SCJP tips Write code that declares, constructs, and initializes arrays of any base type using any of the permitted forms both for declaration and for
More informationJavaScript: Features, Trends, and Static Analysis
JavaScript: Features, Trends, and Static Analysis Joonwon Choi ROPAS Show & Tell 01/25/2013 1 Contents What is JavaScript? Features Trends Static Analysis Conclusion & Future Works 2 What is JavaScript?
More informationReview. CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Let bindings (CBV) Adding Stuff. Booleans and Conditionals
Review CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics e ::= λx. e x ee c v ::= λx. e c (λx. e) v e[v/x] e 1 e 2 e 1 e 2 τ ::= int τ τ Γ ::= Γ,x : τ e 2 e 2 ve 2 ve 2 e[e /x]:
More informationA 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 informationLet Arguments Go First
Let Arguments Go First Ningning Xie and Bruno C. d. S. Oliveira The University of Hong Kong {nnxie,bruno}@cs.hku.hk Abstract. Bi-directional type checking has proved to be an extremely useful and versatile
More informationIST311. Advanced Issues in OOP: Inheritance and Polymorphism
IST311 Advanced Issues in OOP: Inheritance and Polymorphism IST311/602 Cleveland State University Prof. Victor Matos Adapted from: Introduction to Java Programming: Comprehensive Version, Eighth Edition
More informationProgramming 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 informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationTypes-2. Polymorphism
Types-2 Polymorphism Type reconstruction (type inference) for a simple PL Typing functions Coercion, conversion, reconstruction Rich area of programming language research as people try to provide safety
More informationPROGRAMMING LANGUAGE 2
31/10/2013 Ebtsam Abd elhakam 1 PROGRAMMING LANGUAGE 2 Java lecture (7) Inheritance 31/10/2013 Ebtsam Abd elhakam 2 Inheritance Inheritance is one of the cornerstones of object-oriented programming. It
More informationCS 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 informationCSE-505: Programming Languages. Lecture 20.5 Recursive Types. Zach Tatlock 2016
CSE-505: Programming Languages Lecture 20.5 Recursive Types Zach Tatlock 2016 Where are we System F gave us type abstraction code reuse strong abstractions different from real languages (like ML), but
More information1 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 informationSoftware Verification for Java 5
Software Verification for Java 5 KeY Symposium 2007 Mattias Ulbrich June 14, 2007 Content KeY + Java 5 Typesafe Enumeration Datatypes Enhanced For Loops Generic Classes 1. Keep pace with the progress of
More informationUnifying Nominal and Structural Ad-Hoc Polymorphism
Unifying Nominal and Structural Ad-Hoc Polymorphism Stephanie Weirich University of Pennsylvania Joint work with Geoff Washburn Ad-hoc polymorphism Define operations that can be used for many types of
More information