CSE-321 Programming Languages Subtyping POSTECH May 14, 2007 박성우.

Slides:



Advertisements
Similar presentations
Chapter 13 Abstraction and inheritance. This chapter discusses n Implementing abstraction. u extension u inheritance n Polymorphism/dynamic binding. n.
Advertisements

Eiffel: Analysis, Design and Programming Bertrand Meyer (Nadia Polikarpova) Chair of Software Engineering.
Type Systems and Object- Oriented Programming (III) John C. Mitchell Stanford University.
Chapter 9 Pointers and Dynamic Arrays. Overview 9.1 Pointers 9.2 Dynamic Arrays.
Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
Catriel Beeri Pls/Winter 2004/5 last 55 Two comments on let polymorphism I. What is the (time, space) complexity of type reconstruction? In practice –
Chapter 9 Imperative and object-oriented languages 1.
CSE341: Programming Languages Lecture 26 Subtyping for OOP Dan Grossman Fall 2011.
Overview of Java (continue). Announcements You should have access to your repositories and HW0 If you have problems getting HW0, let me know If you’ve.
Subtyping COS 441 Princeton University Fall 2004.
1 COMP313A Programming Languages Object Oriented Progamming Languages (1)
Slides prepared by Rose Williams, Binghamton University Chapter 13 Interfaces and Inner Classes.
Principles of Object-Oriented Software Development The language Java.
Harvey SiyPrinciples of Object-Oriented Software Development by Eliens Slide 1 Behavioral Refinement Principles of Object-Oriented Software Development.
1 Type Type system for a programming language = –set of types AND – rules that specify how a typed program is allowed to behave Why? –to generate better.
Ch 13. Features Found Only in Java Timothy Budd Oregon State University.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases.
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
CSE 332: C++ templates This Week C++ Templates –Another form of polymorphism (interface based) –Let you plug different types into reusable code Assigned.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
Computer Science and Engineering College of Engineering The Ohio State University Lot More Inheritance and Intro to Design Patterns Lecture 12.
Object Oriented Programming: Java Edition By: Samuel Robinson.
Subtyping Chapter 15 Benjamin Pierce Types and Programming Languages.
1 COSC3557: Object-Oriented Programming Haibin Zhu, Ph. D. Associate Professor of CS, Nipissing University.
OOP and Dynamic Method Binding Chapter 9. Object Oriented Programming Skipping most of this chapter Focus on 9.4, Dynamic method binding – Polymorphism.
Inheritance in the Java programming language J. W. Rider.
1 COMP313A Programming Languages Object Oriented Progamming Languages (3)
COP4020 Programming Languages Names, Scopes, and Bindings Prof. Xin Yuan.
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
OO as a language for acm l OO phrase l Mental model of key concepts.
FEN NOEA/IT - Databases/ODB1 ODB – Object DataBases Object-Oriented – Fundamental Concepts UML and EE/R OO and Relational Databases Introduction.
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 17: Inheritance & Behavioral.
Object Relational Features
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 16: Smalltalking about Objects.
Principles of Object-Oriented Software Development The language C++
Principles of programming languages 10: Object oriented languages Isao Sasano Department of Information Science and Engineering.
Conformance Object-Oriented Programming Spring
Team Member Assessments Preliminary Round Second and Third can Influence Grade CSE 403, Winter 2011, Alverson, Brun.
CSCI-383 Object-Oriented Programming & Design Lecture 24.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
CSSE501 Object-Oriented Development. Chapter 10: Subclasses and Subtypes  In this chapter we will explore the relationships between the two concepts.
6-1 Type Conformance and Closed Behavior Constructing class hierarchiesConstructing class hierarchies –need to be careful –two helpful principles: type.
Types and Programming Languages Lecture 10 Simon Gay Department of Computing Science University of Glasgow 2006/07.
CSE 341 Section 10 Subtyping, Review, and The Future.
Arrays Using array as an expression, on the right-hand side Assigning to an array.
CSE-321 Programming Languages Abstract Machine E POSTECH May 1, 2006 박성우.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database.
CSE-321 Programming Languages Dependent Types POSTECH June 5, 2006 박성우.
Subtying Kangwon National University 임현승 Programming Languages These slides were originally created by Prof. Sungwoo Park at POSTECH.
Survey Results. ● Overall, ~38% (mostly) correct responses.
CSCI 383 Object-Oriented Programming & Design Lecture 22 Martin van Bommel.
CSE-321 Programming Languages Simply Typed -Calculus
Multi-Methods in Cecil
Adaptive Code Via C#
CS230 Tutorial Week 3.
Chapter 12 Outline Overview of Object Database Concepts
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Winter 2013.
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Spring 2016.
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Autumn 2018.
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Autumn 2017.
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Zach Tatlock Winter 2018.
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Spring 2017.
5. 3 Coding with Denotations
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Spring 2013.
Subtype Substitution Principle
CSE341: Programming Languages Lecture 25 Subtyping for OOP; Comparing/Combining Generics and Subtyping Dan Grossman Spring 2019.
Presentation transcript:

CSE-321 Programming Languages Subtyping POSTECH May 14, 2007 박성우

2 Key Features of Object-Oriented Languages Multiple representation –different methods of the same name –dynamic dispatch Encapsulation –Only an object's own methods can see private data. Inheritance –classes, subclasses,... Subtyping –interface, interface extension

3 Outline Overview V Principle of subtyping Subtyping relations Coercion semantics

4 Principle of Subtyping

5 Examples

6 Basic Rules Reflexivity and transitivity Rule of subsumption

7 Subset Semantics for Subtyping Example –32-bit word for nat –32-bit word for int –64-bit word for float

8 Outline Overview V Principle of subtyping V Subtyping relations Coercion semantics

9 Setup

10 Subtyping for Product Types

11 Subtyping for Sum Types

12 Subtyping for Function Types

13 Subtyping for Reference Types

You are all so gullible!

15 Wrong Subtyping Rules!

16

17

18 Subtyping for Function Types Covariant in return types B and B' Contravariant in argument types A and A'

19 Dereferencing ref A

20 Assigning to ref A

21 Subtyping for Reference Types A · B corresponds to dereferencing. B · A corresponds to assigning a new value. Nonvariant (neither covariant nor contravariant)

22 Subtyping for Array Types Array types = extension of reference types Subtyping for array types in Java –runtime overhead of dynamic tag-checks.

23 Outline Overview V Principle of subtyping V Subtyping relations V Coercion semantics

24 Coercion Semantics for Subtyping Example –32-bit word for int –64-bit word for float

25 Coercion Subtyping Judgment

26 All coercion functions for A · B ) exhibit the same behavior. Coherence