763 research outputs found
Recursive subtyping revealed
Algorithms for checking subtyping between recursive types lie at the core of many programming language implementations. But the fundamental theory of these algorithms and how they relate to simpler declarative specifications is not widely understood, due in part to the difficulty of the available introductions to the area. This tutorial paper offers an \u27end-to-end\u27 introduction to recursive types and subtyping algorithms, from basic theory to efficient implementation, set in the unifying mathematical framework of coinduction
Semantic subtyping for objects and classes
In this paper we propose an integration of structural subtyping with boolean
connectives and semantic subtyping to define a Java-like programming language
that exploits the benefits of both techniques. Semantic subtyping is an approach
for defining subtyping relation based on set-theoretic models, rather than syntactic
rules. On the one hand, this approach involves some non trivial mathematical
machinery in the background. On the other hand, final users of the language need
not know this machinery and the resulting subtyping relation is very powerful and
intuitive. While semantic subtyping is naturally linked to the structural one, we
show how our framework can also accommodate the nominal subtyping. Several
examples show the expressivity and the practical advantages of our proposal
Typechecking protocols with Mungo and StMungo: a session type toolchain for Java
Static typechecking is an important feature of many standard programming languages. However, static typing focuses on data rather than communication, and therefore does not help programmers correctly implement communication protocols in distributed systems. The theory of session types provides a basis for tackling this problem; we use it to develop two tools that support static typechecking of communication protocols in Java. The first tool, Mungo, extends Java with typestate definitions, which allow classes to be associated with state machines defining permitted sequences of method calls: for example, communication methods. The second tool, StMungo, takes a session type describing a communication protocol, and generates a typestate specification of the permitted sequences of messages in the protocol. Protocol implementations can be validated by Mungo against their typestate definitions and then compiled with a standard Java compiler. The result is a toolchain for static typechecking of communication protocols in Java. We formalise and prove soundness of the typestate inference system used by Mungo, and show that our toolchain can be used to typecheck a client for the standard Simple Mail Transfer Protocol (SMTP)
Towards a Java Subtyping Operad
The subtyping relation in Java exhibits self-similarity. The self-similarity
in Java subtyping is interesting and intricate due to the existence of wildcard
types and, accordingly, the existence of three subtyping rules for generic
types: covariant subtyping, contravariant subtyping and invariant subtyping.
Supporting bounded type variables also adds to the complexity of the subtyping
relation in Java and in other generic nominally-typed OO languages such as C#
and Scala. In this paper we explore defining an operad to model the
construction of the subtyping relation in Java and in similar generic
nominally-typed OO programming languages. Operads, from category theory, are
frequently used to model self-similar phenomena. The Java subtyping operad, we
hope, will shed more light on understanding the type systems of generic
nominally-typed OO languages.Comment: 13 page
- …