241 research outputs found
Why Nominal-Typing Matters in OOP
The statements `inheritance is not subtyping' and `mainstream OO languages
unnecessarily place restrictions over inheritance' have rippled as mantras
through the PL research community for years. Many mainstream OO developers and
OO language designers however do not accept these statements. In
\emph{nominally-typed} OO languages that these developers and language
designers are dearly familiar with, inheritance simply is subtyping; and they
believe OO type inheritance is an inherently nominal notion not a structural
one.
Nominally-typed OO languages are among the most used programming languages
today. However, the value of nominal typing to mainstream OO developers, as a
means for designing robust OO software, seems to be in wait for full
appreciation among PL researchers--thereby perpetuating an unnecessary schism
between many OO developers and language designers and many OO PL researchers,
with each side discounting, if not even disregarding, the views of the other.
In this essay we strengthen earlier efforts to demonstrate the semantic value
of nominal typing by presenting a technical comparison between nominal OO type
systems and structural OO type systems. Recently, a domain-theoretic model of
nominally-typed OOP was compared to well-known models of structurally-typed
OOP. Combined, these comparisons provide a clear and deep account for the
relation between nominal and structural OO type systems that has not been
presented before, and they help demonstrate the key value of nominal typing and
nominal subtyping to OO developers and language designers.
We believe a clearer understanding of the key semantic advantage of pure
nominal OO typing over pure structural OO typing can help remedy the existing
schism. We believe future foundational OO PL research, to further its relevance
to mainstream OOP, should be based less on structural models of OOP and more on
nominal ones instead.Comment: 19 pages. arXiv admin note: text overlap with arXiv:1603.0864
An Overview of Nominal-Typing versus Structural-Typing in OOP
NOOP is a mathematical model of nominally-typed OOP that proves the
identification of inheritance and subtyping in mainstream nominally-typed OO
programming languages and the validity of this identification. This report
gives an overview of the main notions in OOP relevant to constructing a
mathematical model of OOP such as NOOP. The emphasis in this report is on
defining nominality, nominal typing and nominal subtyping of mainstream
nominally-typed OO languages, and on contrasting the three notions with their
counterparts in structurally-typed OO languages, i.e., with structurality,
structural typing and structural subtyping, respectively. An additional
appendix demonstrates these notions and other related notions, and the
differences between them, using some simple code examples. A detailed, more
technical comparison between nominal typing and structural typing in OOP is
presented in other publications.Comment: 16 page
A Comparison of NOOP to Structural Domain-Theoretic Models of OOP
Mainstream object-oriented programming languages such as Java, C#, C++ and
Scala are all almost entirely nominally-typed. NOOP is a recently developed
domain-theoretic model of OOP that was designed to include full nominal
information found in nominally-typed OOP. This paper compares NOOP to the most
widely known domain-theoretic models of OOP, namely, the models developed by
Cardelli and Cook, which were structurally-typed models. Leveraging the
development of NOOP, the comparison presented in this paper provides a clear
and precise mathematical account for the relation between nominal and
structural OO type systems.Comment: 17 page
Subtyping in Java is a Fractal
While developing their software, professional object-oriented (OO) software
developers keep in their minds an image of the subtyping relation between types
in their software. The goal of this paper is to present an observation about
the graph of the subtyping relation in Java, namely the observation that, after
the addition of generics---and of wildcards, in particular---to Java, the graph
of the subtyping relation is no longer a simple directed-acyclic graph (DAG),
as in pre-generics Java, but is rather a fractal. Further, this observation
equally applies to other mainstream nominally-typed OO languages (such as C#,
C++ and Scala) where generics and wildcards (or some other form of 'variance
annotations') are standard features. Accordingly, the shape of the subtyping
relation in these OO languages is more complex than a tree or a simple DAG, and
indeed is also a fractal. Given the popularity of fractals, the fractal
observation may help OO software developers keep a useful and intuitive mental
image of their software's subtyping relation, even if it is a little more
frightening, and more amazing one than before. With proper support from IDEs,
the fractal observation can help OO developers in resolving type errors they
may find in their code in lesser time, and with more confidence.Comment: 18 page
Domain Theory for Modeling OOP: A Summary
Domain theory is `a mathematical theory that serves as a foundation for the
semantics of programming languages'. Domains form the basis of a theory of
partial information, which extends the familiar notion of partial function to
encompass a whole spectrum of "degrees of definedness", so as to model
incremental higher-order computation (i.e., computing with infinite data
values, such as functions defined over an infinite domain like the domain of
integers, infinite trees, and such as objects of object-oriented programming).
General considerations from recursion theory dictate that partial functions are
unavoidable in any discussion of computability. Domain theory provides an
appropriately abstract setting in which the notion of a partial function can be
lifted and used to give meaning to higher types, recursive types, etc. NOOP is
a domain-theoretic model of nominally-typed OOP. NOOP was used to prove the
identification of inheritance and subtyping in mainstream nominally-typed OO
programming languages and the validity of this identification. In this report
we first present the definitions of basic domain theoretic notions and domain
constructors used in the construction of NOOP, then we present the construction
of a simple structural model of OOP called COOP as a step towards the
construction of NOOP. Like the construction of NOOP, the construction of COOP
uses earlier presented domain constructors.Comment: 15 page
Finitary-based Domain Theory in Coq: An Early Report
In domain theory every finite computable object can be represented by a
single mathematical object instead of a set of objects, using the notion of
finitary-basis. In this article we report on our effort to formalize domain
theory in Coq in terms of finitary-basis.Comment: 13 page
Novel Uses of Category Theory in Modeling OOP
An outline and summary of four new potential applications of category theory
to OOP research are presented. These include (1) the use of operads to model
Java subtyping, (2) the use of Yoneda's lemma and representable functors in the
modeling of generic types in generic nominally-typed OOP, (3) using a
combination of category presentations and cartesian closed categories to model
structurally-typed OOP, and (4) the use of adjoint functors to model Java
erasure.Comment: 8 page
Object-Oriented Theorem Proving (OOTP): First Thoughts
Automatic (i.e., computer-assisted) theorem proving (ATP) can come in many
flavors. This document presents early steps in our effort towards defining
object-oriented theorem proving (OOTP) as a new style of ATP.
Traditional theorem proving (TTP) is the only well-known flavor of ATP so
far. OOTP is a generalization of TTP. While TTP is strongly based on functional
programming (FP), OOTP is strongly based on object-oriented programming (OOP)
instead. We believe OOTP is a style of theorem proving that is no less powerful
and no less natural than TTP and thus likely will be no less practically useful
than TTP.Comment: 11 page
Java Subtyping as an Infinite Self-Similar Partial Graph Product
Due to supporting variance annotations, such as wildcard types, the subtyping
relation in Java and other generic nominally-typed OO programming languages is
both interesting and intricate. In these languages, the subtyping relation
between ground object types, i.e., ones with no type variables, is the basis
for defining the full OO subtyping relation, i.e., that includes type
variables.
As an ordering relation over the set of types, the subtyping relation in
object-oriented programming languages can always be represented as a directed
graph. In order to better understand some of the subtleties of the subtyping
relation in Java, in this paper we present how the subtyping relation between
ground Java types can be precisely constructed using two new operations (a
binary operation and a unary one) on directed graphs. The binary operation we
use, called a partial Cartesian graph product, is similar in its essence to
standard graph products and group products. Its definition is based in
particular on that of the standard Cartesian graph product.
We believe the use of graph operations in constructing the ground generic
Java subtyping relation reveals some of the not-immediately-obvious structure
of the subtyping relation not only in Java but, more generally, also in
mainstream generic nominally-typed OO programming languages such as C#, Scala
and Kotlin. Accordingly, we believe that describing precisely how graph
operations can be used to explicitly construct the subtyping relation in these
languages, as we do in this paper, may significantly improve our understanding
of features of the type systems of these languages such as wildcard types and
variance annotations, and of the dependency of these features on nominal
subtyping in nominally-typed OOP.Comment: 11 page
Towards Understanding Generics in Mainstream OOP
This article reports on steps towards building a simple and accurate
domain-theoretic model of generic nominally-typed OOP.Comment: 29 page
- …