1,487 research outputs found
First-Class Subtypes
First class type equalities, in the form of generalized algebraic data types
(GADTs), are commonly found in functional programs. However, first-class
representations of other relations between types, such as subtyping, are not
yet directly supported in most functional programming languages.
We present several encodings of first-class subtypes using existing features
of the OCaml language (made more convenient by the proposed modular implicits
extension), show that any such encodings are interconvertible, and illustrate
the utility of the encodings with several examples.Comment: In Proceedings ML 2017, arXiv:1905.0590
A Type System for First-Class Layers with Inheritance, Subtyping, and Swapping
Context-Oriented Programming (COP) is a programming paradigm to encourage
modularization of context-dependent software. Key features of COP are
layers---modules to describe context-dependent behavioral variations of a
software system---and their dynamic activation, which can modify the behavior
of multiple objects that have already been instantiated. Typechecking programs
written in a COP language is difficult because the activation of a layer can
even change objects' interfaces. Inoue et al. have informally discussed how to
make JCop, an extension of Java for COP by Appeltauer et al., type-safe.
In this article, we formalize a small COP language called ContextFJ
with its operational semantics and type system and show its type soundness. The
language models main features of the type-safe version of JCop, including
dynamically activated first-class layers, inheritance of layer definitions,
layer subtyping, and layer swapping
A type system for components
In modern distributed systems, dynamic reconfiguration, i.e.,
changing at runtime the communication pattern of a program, is chal-
lenging. Generally, it is difficult to guarantee that such modifications will
not disrupt ongoing computations. In a previous paper, a solution to this
problem was proposed by extending the object-oriented language ABS
with a component model allowing the programmer to: i) perform up-
dates on objects by means of communication ports and their rebinding;
and ii) precisely specify when such updates can safely occur in an object
by means of critical sections. However, improper rebind operations could
still occur and lead to runtime errors. The present paper introduces a
type system for this component model that extends the ABS type system
with the notion of ports and a precise analysis that statically enforces
that no object will attempt illegal rebinding
Modular session types for objects
Session types allow communication protocols to be specified
type-theoretically so that protocol implementations can be verified by static
type checking. We extend previous work on session types for distributed
object-oriented languages in three ways. (1) We attach a session type to a
class definition, to specify the possible sequences of method calls. (2) We
allow a session type (protocol) implementation to be modularized, i.e.
partitioned into separately-callable methods. (3) We treat session-typed
communication channels as objects, integrating their session types with the
session types of classes. The result is an elegant unification of communication
channels and their session types, distributed object-oriented programming, and
a form of typestate supporting non-uniform objects, i.e. objects that
dynamically change the set of available methods. We define syntax, operational
se-mantics, a sound type system, and a sound and complete type checking
algorithm for a small distributed class-based object-oriented language with
structural subtyping. Static typing guarantees that both sequences of messages
on channels, and sequences of method calls on objects, conform to
type-theoretic specifications, thus ensuring type-safety. The language includes
expected features of session types, such as delegation, and expected features
of object-oriented programming, such as encapsulation of local state.Comment: Logical Methods in Computer Science (LMCS), International Federation
for Computational Logic, 201
A Type-Safe Model of Adaptive Object Groups
Services are autonomous, self-describing, technology-neutral software units
that can be described, published, discovered, and composed into software
applications at runtime. Designing software services and composing services in
order to form applications or composite services requires abstractions beyond
those found in typical object-oriented programming languages. This paper
explores service-oriented abstractions such as service adaptation, discovery,
and querying in an object-oriented setting. We develop a formal model of
adaptive object-oriented groups which offer services to their environment.
These groups fit directly into the object-oriented paradigm in the sense that
they can be dynamically created, they have an identity, and they can receive
method calls. In contrast to objects, groups are not used for structuring code.
A group exports its services through interfaces and relies on objects to
implement these services. Objects may join or leave different groups. Groups
may dynamically export new interfaces, they support service discovery, and they
can be queried at runtime for the interfaces they support. We define an
operational semantics and a static type system for this model of adaptive
object groups, and show that well-typed programs do not cause
method-not-understood errors at runtime.Comment: In Proceedings FOCLASA 2012, arXiv:1208.432
- …