949 research outputs found
Set-Theoretic Types for Polymorphic Variants
Polymorphic variants are a useful feature of the OCaml language whose current
definition and implementation rely on kinding constraints to simulate a
subtyping relation via unification. This yields an awkward formalization and
results in a type system whose behaviour is in some cases unintuitive and/or
unduly restrictive. In this work, we present an alternative formalization of
poly-morphic variants, based on set-theoretic types and subtyping, that yields
a cleaner and more streamlined system. Our formalization is more expressive
than the current one (it types more programs while preserving type safety), it
can internalize some meta-theoretic properties, and it removes some
pathological cases of the current implementation resulting in a more intuitive
and, thus, predictable type system. More generally, this work shows how to add
full-fledged union types to functional languages of the ML family that usually
rely on the Hindley-Milner type system. As an aside, our system also improves
the theory of semantic subtyping, notably by proving completeness for the type
reconstruction algorithm.Comment: ACM SIGPLAN International Conference on Functional Programming, Sep
2016, Nara, Japan. ICFP 16, 21st ACM SIGPLAN International Conference on
Functional Programming, 201
Static and dynamic semantics of NoSQL languages
We present a calculus for processing semistructured data that spans
differences of application area among several novel query languages, broadly
categorized as "NoSQL". This calculus lets users define their own operators,
capturing a wider range of data processing capabilities, whilst providing a
typing precision so far typical only of primitive hard-coded operators. The
type inference algorithm is based on semantic type checking, resulting in type
information that is both precise, and flexible enough to handle structured and
semistructured data. We illustrate the use of this calculus by encoding a large
fragment of Jaql, including operations and iterators over JSON, embedded SQL
expressions, and co-grouping, and show how the encoding directly yields a
typing discipline for Jaql as it is, namely without the addition of any type
definition or type annotation in the code
Java and scala's type systems are unsound: the existential crisis of null pointers
We present short programs that demonstrate the unsoundness of Java and Scala's current type systems. In particular, these programs provide parametrically polymorphic functions that can turn any type into any type without (down) casting. Fortunately, parametric polymorphism was not integrated into the Java Virtual Machine (JVM), so these examples do not demonstrate any unsoundness of the JVM. Nonetheless, we discuss broader implications of these findings on the field of programming languages
A Type System for Tom
Extending a given language with new dedicated features is a general and quite
used approach to make the programming language more adapted to problems. Being
closer to the application, this leads to less programming flaws and easier
maintenance. But of course one would still like to perform program analysis on
these kinds of extended languages, in particular type checking and inference.
In this case one has to make the typing of the extended features compatible
with the ones in the starting language.
The Tom programming language is a typical example of such a situation as it
consists of an extension of Java that adds pattern matching, more particularly
associative pattern matching, and reduction strategies.
This paper presents a type system with subtyping for Tom, that is compatible
with Java's type system, and that performs both type checking and type
inference. We propose an algorithm that checks if all patterns of a Tom program
are well-typed. In addition, we propose an algorithm based on equality and
subtyping constraints that infers types of variables occurring in a pattern.
Both algorithms are exemplified and the proposed type system is showed to be
sound and complete
What Are Polymorphically-Typed Ambients?
Abstract: The Ambient Calculus was developed by Cardelli and Gordon as a formal framework to study issues of mobility and migrant code. We consider an Ambient Calculus where ambients transport and exchange programs rather that just inert data. We propose different senses in which such a calculus can be said to be polymorphically typed, and design accordingly a polymorphic type system for it. Our type system assigns types to embedded programs and what we call behaviors to processes; a denotational semantics of behaviors is then proposed, here called trace semantics, underlying much of the remaining analysis. We state and prove a Subject Reduction property for our polymorphically typed calculus. Based on techniques borrowed from finite automata theory, type-checking of fully type-annotated processes is shown to be decidable; the time complexity of our decision procedure is exponential (this is a worst-case in theory, arguably not encountered in practice). Our polymorphically-typed calculus is a conservative extension of the typed Ambient Calculus originally proposed by Cardelli and Gordon
- …