Author: Ian Stark

This lecture set out some alternative approaches for managing concurrency in programming languages: asynchronous message-passing Actors and the cheerfully optimistic concurrency of Software Transactional Memory. These are two examples from a wide range of mechanisms in use across many programming languages and applications domains, all of which seek to balance the key concurrency requirements of separation to prevent inconsistency and co-operation to allow interaction.

Moving on from type systems, today’s lecture started to look at programming for concurrency: why you might want — or need — to write concurrent code and some of the challenges in doing so. I also introduced some of the concurrency primitives in Java and how they are used, as well as telling a story about the Apollo Guidance Computer and the robustness of its concurrent event handling under input overload.

I’ve collated the tremendous set of links sent in covering the assigned coursework topics. Thank you all, especially those who sent in multiple suggestions for each one. Many of these were new to me and these cover a great range of different types of material. Read the blog post to see the links.

Today’s lecture completes the quartet of type/term interactions: after first-class functions, parameterized types, and polymorphic terms, we have types that depend on terms themselves. Numerical examples include types to capture vector lengths and matrix dimensions, and thereby specify more precisely the domain and range of operations like matrix inversion or multiplication. Dependent types can also be used to strengthen the deep embedding of domain-specific languages into a host meta-language. Examples of this included typed lambda-terms and logical formulas. The lecture also touched on the Curry-Howard correspondence of propositions-as-types seen earlier in Wadler’s talk, and the use of dependently-typed programming in the machine-assisted proof of mathematical theorems. Finally, there were some references to dependently-typed languages for writing and verifying programs that are correct by construction.

Rupert Smith on “Elm: Taming the Wild West Web using Functional Programming”, 7pm Tuesday 9 October at The Outhouse, 12A Broughton Street Lane. This is the monthly meetup of EdLambda, an Edinburgh group for people interested in functional programming. APL students are very welcome to come along.

Digging deeper into types for parametric polymorphism, this lecture reviewed Hindley-Milner systems with let-polymorphism and type inference before moving on to System F with more explicit interaction between types and terms. Exercises explore how familiar datatypes can be encoded in System F purely as polymorphic functions.

PLInG is an informal meeting series for Informatics students and staff interested in programming languages. The next meeting is on Thursday, tomorrow, and we’ll hear from those just back from last week’s International Conference on Functional Programming in St. Louis.

This lecture continued the exploration of polymorphism from Lecture 3 with more varieties of polymorphism and more expressive applications of the technique. This included: subtypes and the Liskov substitutivity principle; how this interacts with parametric types; covariant, contravariant and invariant types; how subtyping is not inheritance; polymorphic type schemes; Hindley-Milner type inference; rank-2 types and higher; and the history of the Great Computer Language Shootout.