Covariance and Controvariance: a fresh look at an old issue (a primer in advanced type systems for learning functional programmers)

09/05/2018
by   Giuseppe Castagna, et al.
0

Twenty years ago, in an article titled "Covariance and contravariance: conflict without a cause", I argued that covariant and contravariant specialization of method parameters in object-oriented programming had different purposes and deduced that, not only they could, but actually they should both coexist in the same language. In this work I reexamine the result of that article in the light of recent advances in (sub-)typing theory and programming languages, taking a fresh look at this old issue. Actually, the revamping of this problem is just an excuse for writing an essay that aims at explaining sophisticated type-theoretic concepts, in simple terms and by examples, to undergraduate computer science students and/or willing functional programmers. Finally, I took advantage of this opportunity to describe some undocumented advanced techniques of type-systems implementation that are known only to few insiders that dug in the code of some compilers: therefore, even expert language designers and implementers may find this work worth of reading.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
02/26/2019

Induction, Coinduction, and Fixed Points in PL Type Theory

Recently we presented a concise survey of the formulation of the inducti...
research
03/28/2023

Cesno: Possibility of Creating a New Programming Language

Programming languages are incredibly versatile, enabling developers to c...
research
12/25/2018

Induction, Coinduction, and Fixed Points: A Concise Comparative Survey (and Tutorial)

In this survey paper (which hitherto is an ongoing work-in-progress) we ...
research
07/26/2022

Design of Classes I

The use of functional programming languages in the first programming cou...
research
06/22/2022

Functional or imperative? On pleasant semantics for differentiable programming languages

In machine learning (ML), researchers and engineers seem to be at odds. ...
research
07/08/1999

No information can be conveyed by certain events: The case of the clever widows of Fornicalia and the Stobon Oracle

In this short article, we look at an old logical puzzle, its solution an...
research
07/13/2023

Typed Design Patterns for the Functional Era

This paper explores how design patterns could be revisited in the era of...

Please sign up or login with your details

Forgot password? Click here to reset