21 research outputs found

    First-Class Subtypes

    Full text link
    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

    Expressive modular linking for object-oriented languages

    Get PDF
    technical reportIn this paper we show how modular linking of program fragments can be added to statically typed, object-oriented (OO) languages. Programs are being assembled out of separately developed software components deployed in binary form. Unfortunately, mainstream OO languages (such as Java) still do not provide support for true modular linking. Modular linking means that program fragments can be separately compiled and type checked, and that linking can ensure global program type correctness without analyzing program fragment implementations. Supporting modular linking in OO languages is complicated by two expressive features that current OO languages do not support together: mixin-style inheritance across program fragment boundaries, and cyclic dependencies between program fragments. In a previous paper at OOPSLA 2001, we have demonstrated the practical uses for such expressiveness. When such expressiveness is permitted, link-time type checking rules must ensure that method collisions and inheritance cycles do not occur after program fragments are linked into a program. In this paper, we show how modular linking with both cyclic linking and mixin-style inheritance can be supported using a type-checking architecture that can be added on top of existing OO languages, such as Java.

    Extending FeatherTrait Java with Interfaces

    Get PDF
    International audienceIn the context of Featherweight Java by Igarashi, Pierce, and Wadler, and its recent extension FeatherTrait Java (FTJ) by the authors, we investigate classes that can be extended with trait composition. A trait is a collection of methods, i.e. behaviors without state; it can be viewed as an "incomplete stateless class" ie, an interface with some already written behavior. Traits can be composed in any order, but only make sense when "imported" by a class that provides state variables and additional methods to disambiguate conflicting names arising between the imported traits. We introduce FeatherTrait Java with interfaces (iFTJ), where traits need to be typechecked only once, which is necessary for compiling them in isolation, and considering them as regular types, like Java-interfaces with a behavioral content

    Can Programming be Liberated from the Two-Level Style? Multi-Level Programming with DeepJava

    Get PDF
    Since the introduction of object-oriented programming few programming languages have attempted to provide programmers with more than objects and classes, i.e., more than two levels. Those that did, almost exclusively aimed at describing language properties—i.e., their metaclasses exert linguistic control on language concepts and mechanisms— often in order to make the language extensible. In terms of supporting logical domain classification levels, however, they are still limited to two levels. In this paper we conservatively extend the object-oriented programming paradigm to feature an unbounded number of domain classification levels. We can therefore avoid the introduction of accidental complexity into programs caused by accommodating multiple domain levels within only two programming levels. We present a corresponding language design featuring “deep instantiation ” and demonstrate its features with a running example. Finally, we outline the implementation of our compiler prototype and discuss the potentials of further developing our language design

    Privacy via subsumption

    Get PDF
    We describe an object calculus allowing object extension and structural subtyping. Each object has a “dictionary ” to mediate the connection between names and components. This extra indirection yields the first object calculus combining both object extension and full width subtyping in a type-safe manner. If class inheritance is modeled with object extension, private fields and methods can be achieved directly by scoping restrictions: private fields or methods are those hidden by subsumption. We prove that the type system is sound, discuss a variant allowing covariant self types, and give some examples of the expressiveness of the calculus. C ○ 2002 Elsevier Scienc
    corecore