Why Nominal Typing Matters in Mainstream OOP
In 1990, Cook et al. shocked the programming languages (PL) research community by declaring that, in object oriented programming, 'inheritance is not subtyping, meaning there is no one to one correspondence between the two notions in OO programming languages, further adding that mainstream OO languages unnecessarily 'place restrictions over inheritance. Over the years, these statements rippled, as mantras, through the PL research community. To this day, however, many mainstream OO developers and OO language designers cannot digest or accept not identifying type inheritance with subtyping. Simply, the statement of Cook et al. is not true in nominally typed OO languages such as Java, C# C+ and Scala that these developers and language designers are dearly familiar with. Further, they see that the so called "restriction" of type inheritance in these languages is strongly justified, or, more so, that a structural view of inheritance is in fact an unjustified redefinition of inheritance, which they view as an inherently nominal notion. Nominally typed OO languages are among the top most used programming languages today. In spite of that, the value of nominal typing and nominal subtyping to mainstream OO developers, as a means for designing robust OO software, as well as the value of properties of OO type systems that depend on nominality (such as the identification of type inheritance with subtyping) seem to be not yet fully appreciated among PL researchers perpetuating an unnecessary tension and schism between two large and significant communities: many mainstream OO developers and language designers, on one side, and many OO PL researchers, on the other side, with each of both sides discounting, if not even disregarding, the views and opinions of the other. In this essay we complement and strengthen earlier efforts that aimed to demonstrate the semantic value of nominal typing, particularly the association of class names with behavioral class contracts, by making a technical comparison between nominal OO type systems and structural OO type systems. In other recent work, we also compared NOOP, our domain theoretic model of nominally typed OOP, to models of structurally typed OOP developed and disseminated by Cardelli, Cook, and others. These comparisons provide a clear, deep technical and mathematical account for the relation between nominal and structural OO type systems that, due to earlier lack of a domain theoretic model of nominally typed OOP, has not been presented before. They should help further demonstrate, to OO