Advances in Programming Languages


Lecture Log

Note: This page refers to a past version of the course. You can also consult the current APL course web pages.

Link: Course webpage. Jump to lecture: 1, 2, 3, 4, 5, 6.

New! The lecture log is (probably) moving to a blog.

2009-01-12 Lecture 1: What's so important about language?

Introduction to the course; review of some programming languages; how languages shape programs; some topics to be covered in the course.

Homework: Lecture 2 concerns the language Objective Caml (OCaml). You can find out about this at the Caml Language home page. Before the next lecture you should:

Also, Wikipedia's History of programming languages is an easy read and fairly informative.


George Boole. An Investigation of the Laws of Thought on Which are Founded the Mathematical Theories of Logic and Probabilities. Macmillan, 1854.

Ludwig Wittgenstein. Tractatus Logic-Philosophicus, Ogden (trans.), Routledge & Kegan Paul, 1922. English translation of German original, Logisch-Philosophische Abhandlung, Wilhelm Ostwald (ed.), Annalen der Naturphilosophie 14, 1921.

George Orwell. Nineteen Eighty-Four. A Novel. Secker & Warburg, 1949.

Update: Having flippantly included a quote from 1984, I now discover that the prototype release of the Newspeak programming language is due out this month.

Alan Perlis. Epigrams on Programming. ACM SIGPLAN Notices 17(9):7–13. September 1982.

Jeremy Gibbons. An unbounded spigot algorithm for the digits of π. American Mathematical Monthly 113(4):318-328, 2006.

Graham Hutton and Erik Meijer. Monadic parsing in Haskell. Journal of Functional Programming 8(4):437-444, July 1998.

Chris Okasaki. Even Higher-Order Functions for Parsing or Why Would Anyone Ever Want To Use a Sixth-Order Function? Journal of Functional Programming, 8(2):195-199, March 1998.

Donald Knuth. Structured Programming with go to Statements, ACM Computing Surveys 6(4):261–301, December 1974.

Alan Turing. Proposed Electronic Calculator, 1945. Submitted to the Executive Committee of the National Physical Laboratory in February 1946, as “Report by Dr. A. M. Turing on Proposals for the Development of an Automatic Computing Engine (ACE)”.

This is held in the British National Archives at Kew (ref. DSIR 10/385). You can view it online in the Turing Archive, as item AMT/C/32; there is also a PDF scan of the typescript report available.

The report has been reprinted in various collections, with accompanying annotations and introductions.

2009-01-15 Lecture 2: Types and type systems

Different examples of types in programming languages; what is a type system; a problem with Java array subtyping; covariant, contravariant and invariant type dependencies; brief mention of OCaml.


By the next lecture on Monday:

Lecture 3 will present material on the OCaml language. If you have not done the homework from last time, do it now. If you are still uncertain about OCaml programming, try these online guides:


Robin Milner. A theory of type polymorphism in programming, Journal of Computer and System Sciences 17(3):348–375. December 1978.

Martin Odersky, Lex Spoon, and Bill Venners. Programming in Scala. Artima, November 2008.

The Scala programming language smoothly integrates object-oriented and functional features in a concise and type-safe way. It is fully interoperable with the Java language and Java runtime environment, and also the .NET Framework from Microsoft. Martin Odersky is the language designer.

Links: Scala; Introduction; A Tour of Scala.

Gilad Bracha. Annotations: Towards Pluggable Types and Pluggable Types. From the Computational Theology blog, 2005/2006.

Bracha is one of the co-authors of the Java Language Specification, and writes about a range of object-oriented programming issues on his blog See also note above on the Newspeak language, of which he is a designer.

2009-01-19 Lecture 3: A little OCaml

Brief overview of basic expressions and types in OCaml. Some choices in type systems: nominal vs. structural typing; parametric and classic OO polymorphism. OCaml example: region quadtrees for efficient image representation.

Homework: Basic exercises, just reviewing the lecture material:

More advanced exercises, requiring you to write original code:

OCaml graphics are described in the language manual and Chapter 5 of Developing Applications with Objective Caml.

Post your results on the newsgroup; and if you find any additional information necessary for using OCaml or its graphics library on platforms other than DICE, post that too.


Benjamin c. Pierce. Types and Programming Languages. MIT press, 2002.

This is the textbook for a whole course on types for programming. It's expensive, but the University library has several copies for loan.

Mauric Naftalin, Phil Wadler. Java Generics and Collections. O'Reilly, 2006.

All about how to use Java Generics, and particularly their appearance in the Collections library classes.

Java Programming Language: Enhancements in JDK 5. Sun Microsystems, 2004. Available at

The first section is on generics: “This long-awaited enhancement to the type system allows a type or method to operate on objects of various types while providing compile-time type safety. It adds compile-time type safety to the Collections Framework and eliminates the drudgery of casting.”

Gilad Bracha. Generics in the Java Programming Language. Sun Microsystems, July 2004.

Available from the JDK 5 webpage above, this is a tutorial on using generics.

Bracha, Odersky, Stoutamire, and Wadler. GJ: Extending the Java Programming Language with type parameters. Manuscript, August 1998. Available at

A tutorial for the GJ language, from which Java took its implementation of generics.

GJ: A Generic Java Language Extension. Web site

Details about GJ and its history.

The story of how parametric polymorphism made it from purely functional languages like Haskell and ML into the object-oriented world of Java and C# generics is spread across several research papers, presented at computer science conferences and published in learned journals. These are fairly technical, but do give some indication of the mathematical background and research required to safely add powerful features to a general-purpose programming language.

Bracha, Odersky, Stoutamire, and Wadler. Making the Future Safe for the Past: Adding Genericity to the Java Programming Language. In Proc. OOPSLA '98, ACM SIGPLAN Notices 10(33):183–200. ACM Press, 1998. DOI: 10.1145/286942.286957

Torgersen, Hansen, Ernst, Ahe, Bracha and Gafter. Adding Wildcards to the Java Programming Language. In Proc. 2004 ACM Symposium on Applied Computing. ACM Press, 2004. DOI: 10.1145/967900.968162

Describes the addition of “?” wildcards to increase the power of parametric polymorphism in Java.

Andrew Kennedy, Don Syme. Design and Implementation of Generics for the .NET Common Language Runtime. In Proc. PLDI '2001, pp.1–12. ACM Press, 2001. DOI: 10.1145/378795.378797

Don Syme, Andy Gordon. Typing a Multilanguage Intermediate Code. In Proc. POPL '01, ACM SIGPLAN Notices 36(3):248–260. ACM Press, 2001. DOI: 10.1145/373243.360228

Dachuan Yu, Andrew Kennedy, Don Syme. Formalization of Generics for the .NET Common Language Runtime. In Proc. POPL '04, ACM SIGPLAN Notices 39(1):39–51. ACM Press, 2004. DOI: 10.1145/982962.964005

2009-01-22 Lecture 4: Row variables in OCaml — Structural typing for objects

Demonstration of quadtrees and octrees for collision detection; the challenge of static type-checking for object-oriented programming; OCaml's use of row variables and row polymorphism to provide structural typing for objects.



Method java.util.Collections.max in the Java 2 Platform, Standard Edition, v1.3.1 API Specification. Sun, 2001. (This method was present in v1.2.2, but Sun no longer provide online documentation.)

Method java.util.Collections.max in the Java Platform, Standard Edition 6 API Specification. Sun, 2006.

Didier Rémy. Using, Understanding, and Unraveling The OCaml Language: From Practice to Theory and vice versa. In Applied Semantics, Proceedings of the International Summer School APPSEM 2000. Lecture Notes in Computer Science 2395. Springer, 2002.

Rémy is the chief designer of the OCaml object system. This tutorial covers all of OCaml; Objects are treated in Chapter 3.

Didier Rémy and Jérôme Vouillon. Objective ML: An effective object-oriented extension to ML. In Theory And Practice of Object Systems 4(1):27–50, 1998.

An original paper setting out the use of row variables for ML. Quite technical, and the syntax is different to that eventually used in OCaml.

Jon Harrop. OCaml for Scientists. Flying Frog, 2005.

Copies available in the University library.

Emmanuel Chailloux, Pascal Manoury and Bruno Pagano. Développement d'applications avec Objective Caml. O'Reilly, 2000.

Thanks to the translation efforts of a volunteer collaboration, there is an English version available online.

Jon Harrop. F# for Scientists. Wiley, 2008.

Copies on order for the University library.

2009-01-26 Lecture 5: Coursework assignment

Presentation of coursework topics; suggested report outline; notes on working practices.

Link: Coursework web page.

2009-01-29 Lecture 6: Hoare logic

First-order logic; a simple imperative language; Hoare triples. Rules for derivation; validity with respect to an operational semantics; soundness and completeness. Applications in program specification and verification; tools for formal verification; Design by Contract™.


C. A. R. Hoare. An axiomatic basis for computer programming. Communications of the ACM 12(10):576–580, 1969. DOI 10.1145/363235.363259

Hoare's original article setting out the use of triples. Note that this uses the notation P{C}Q with braces around the command rather than the assertions.

Hoare and Jones (editor), Essays in Computing Science. ACM Classic Books Series. Originally published by Prentice Hall, 1989.

A collection of articles by Hoare. Proving programs correct is addressed in most chapters, but particularly 4 and 5.

Both the article and the book should be directly available from machines within the University. For access from outside you can use a proxy provided by the University Library:

Eiffel Software. Building bug-free O-O software: An introduction to Design by Contract™. Available from

Design methodologies often attract heated discussion of their effectiveness. For example, would design by contract have averted the Ariane disaster? Look at the following two articles:

Glynn Winskel. The Formal Semantics of Programming Languages: An Introduction. MIT Press, 1993.

Textbook introduction to the subject. Chapter 6 presents axiomatic semantics and Hoare logic. Good if you want to find out about more about language semantics and verification.

Tobias Nipkow. Hoare Logics for Recursive Procedures and Unbounded Nondeterminism. In Computer Science Logic: Proceedings of CSL 2002. Lecture Notes in Computer Science 2471, pages 103–119. Springer, 2002. DOI: 10.1007/3-540-45793-3_8

Technical article describing a machine-checked proof that Hoare logic is sound and complete. Section 3 gives some history of the "consequence" rule. Again, the article is available directly from within the University, or through a library proxy from outside:

Keats, Ode to a Grecian Urn. In The Oxford Book of English Verse, 1250–1900, 625. Quiller-Couch (ed.) Oxford: Clarendon Press, 1919. Available online at
Beauty is truth, truth beauty — that is all
Ye know on earth, and all ye need to know

Keats praising the virtue of "Mysteries, doubts without any irritable reaching after fact & reason". Not a fan of formal semantics, we guess.

Home : Teaching : Courses : Apl : 2008-2009 

Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail:
Please contact our webadmin with any comments or corrections. Logging and Cookies
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh