Lecture material on subtypes can be found in Chapter 5 of my new book, Foundations of Object-Oriented Languages: Types and Semantics, by Kim Bruce (©2002 by MIT Press). The relevant material for this lecture is included in section 5.1. Other material will be relevant when we get to object-oriented languages, next. I will not bother to put detailed lecture notes on-line because the chapter covers the same material (and examples!).
Discussed subtyping for:
immutable record types
Updatable record types
MODULE Foo; TYPE base = RECORD x : INTEGER; END; derived1 = RECORD(base) y : INTEGER; END; derived2 = RECORD(base) z : INTEGER; END; VAR b : POINTER to base; PROCEDURE bar(OUT a1 : POINTER TO derived1; OUT a2 : POINTER TO derived2); BEGIN NEW(a2); NEW(a1); a2^.z := 42; END bar; BEGIN bar(b, b); END Foo.The extra information needed to understand this is that OUT parameters in Component Pascal are passed by reference! There is no problem if OUT parameters are passed by copy (i.e., call by result).
Biggest loss in moving from FORTRAN to Pascal is lack of support for modules with persistent local data.
Clu, Ada, and Modula 2 attempted to remedy this by adding clusters, packages, and modules.
In Ada & Modula 2, objects (i.e. packages, and modules) were late additions to an earlier paradigm (Pascal-like)
ADT languages provide reasonable support for all but extensibility (in particular if want minor extensions - but rest is same), some limitations on reuseability.
Object-oriented languages are an attempt to make progress toward these goals.
A programming language is object-oriented if:
Simula 67 first object-oriented language - designed for discrete simulations.
Up until late '80's, Smalltalk best-known - Alan Kay at Xerox.
Gone through Smalltalk-72,-74,-76,-78,-80.
C++, object-oriented extensions to Pascal, C, LISP, etc.
One of nicest is Eiffel - discuss later (See Meyer's Object-Oriented Software Construction). Also Sather (public-domain variant of Eiffel). Of course Java is now becoming the most popular (and one of best).
Object-oriented languages built around following concepts:
Objects are internal data abstractions - only accessible to outer world through associated procedures
Most current OOL's identify object types and classes (in particular subtypes and subclasses).
See later this can lead to holes in typing system and/or restrictions in expressibility.
In typical object-oriented programming language, everything is an object.
Abstraction preserved since no object can make changes to the internal state of another object - though some languages don't enforce this - just send messages using methods in the public interface.
Three factors worked toward the sudden popularity of Java:
Clean and (relatively) simple language design
Use of garbage collection
Built-in support for event-driven programming and concurrency.