Type Access Analysis: Towards Informed Interface Design (original) (raw)

A first-class approach to genericity

Sigplan Notices, 2003

This paper describes how to add first-class generic typesincluding mixins-to strongly-typed OO languages with nominal subtyping such as Java and C#. A generic type system is "first-class" if generic types can appear in any context where conventional types can appear. In this context, a mixin is simply a generic class that extends one of its type parameters, e.g., a class C that extends T. Although mixins of this form are widely used in C++ (via templates), they are clumsy and error-prone because C++ treats mixins as macros, forcing each mixin instantiation to be separately compiled and type-checked. The abstraction embodied in a mixin is never separately analyzed.

Notes on Type Abstraction (Version 2)

IEEE Transactions on Software Engineering, 2000

She is presently a Computer Scientist for the Information Systems Staff at the Naval Research Laboratory, Washington, DC. Her research interests include program design methodologies and parallel processing.

On the use of type predicates in object-oriented software

Proceedings of the 10th ACM Symposium on Dynamic languages - DLS '14, 2014

Object-orientation relies on polymorphism to express behavioral variants. As opposed to traditional procedural design, explicit typebased conditionals should be avoided. This message is conveyed in introductory material on object orientation, as well as in objectoriented reengineering patterns. Is this principle followed in practice? In other words, are type predicates actually used in objectoriented software, and if so, to which extent?

An extended comparative study of language support for generic programming

Journal of Functional Programming, 2006

Many modern programming languages support basic generics, sufficient to implement type-safe polymorphic containers. Some languages have moved beyond this basic support, and in doing so have enabled a broader, more powerful form of generic programming. This paper reports on a comprehensive comparison of facilities for generic programming in eight programming languages: C++, Standard ML, Objective Caml, Haskell, Eiffel, Java, C# (with its proposed generics extension), and Cecil. By implementing a substantial example in each of these languages, we illustrate how the basic roles of generic programming can be represented in each language. We also identify eight language properties that support this broader view of generic programming: support for multi-type concepts, multiple constraints on type parameters, convenient associated type access, constraints on associated types, retroactive modeling, type aliases, separate compilation of algorithms and data structures, and implicit argument t...

Beyond Generics: Meta-Level Parameterization For Effective Generic Programming

benefits

Generic (polymorphic) type-safe containers are the primary motivation for generics (in Ada, Eiffel, and recently proposed additions to Java and C#) and templates (in C++). We studied buffer classes and found that they could not be unified by type parameters. At times, unification required non-type parameters (e.g., parameters representing operators, keywords or algorithmic details) and at other times -the nature of variations was not parametric which called for a more general unification mechanism. Investigation of the reasons behind the observed symptoms revealed that unification problems were caused by "feature combinations": Other than by type, each class was also affected by yet other features and implementation of various features interacted with classes in rather chaotic ways. In the paper, we show examples of how the feature combination manifests in programs. We believe that we are dealing with a fundamental phenomenon that will cause many other class containers and application programs to suffer from the same problem. In our case study, some of the difficulties were caused by limitations specific to Java generics. Yet others were more fundamental and reflected the weakness of parameterization mechanisms supported by today's programming languages. We suggest that stronger generics systems would considerably enhance capabilities of programming languages in the areas of generic programming, reuse and maintenance. We refer to a meta-level parameterization mechanism that can effectively unify any types of variations triggered by feature combination, and can be applied to any programming language. We discuss the trade-offs between conventional type-parametric generics built-into today's programming languages and the meta-level parameterization approach.

Types, Data Abstraction, and Polymorphism

Our objective is to understand the notion of type in programming languages, present a model of typed, polymorphic programming languages that reflects recent research in type theory, and examine the relevance of recent research to the design of practical programming languages. Object-oriented languages provide both a framework and a motivation for exploring the interaction among the concepts of type, data abstraction, and polymorphism, since they extend the notion of type to data abstraction and since type inheritance is an important form of polymorphism. We develop a X-calculus-based model for type systems that allows us to explore these interactions in a simple setting, unencumbered by complexities of production programming languages. The evolution of languages from untyped universes to monomorphic and then polymorphic type systems is reviewed. Mechanisms for polymorphism such as overloading, coercion, subtyping, and parameterization are examined. A unifying framework for polymorphic type systems is developed in terms of the typed A-calculus augmented to include binding of types by quantification as well as binding of values by abstraction. The typed X-calculus is augmented by universal quantification to model generic functions with type parameters, existential quantification and packaging (information hiding) to model abstract data types, and bounded quantification to model subtypes and type inheritance. In this way we obtain a simple and precise characterization of a powerful type system that includes abstract data types, parametric polymorphism, and multiple inheritance in a single consistent framework. The mechanisms for type checking for the augmented X-calculus are discussed. The augmented typed X-calculus is used as a programming language for a variety of illustrative examples. We christen this language Fun because fun instead of X is the functional abstraction keyword and because it is pleasant to deal with. Fun is mathematically simple and can serve as a basis for the design and implementation of real programming languages with type facilities that are more powerful and expressive than those of existing programming languages. In particular, it provides a basis for the design of strongly typed object-oriented languages.

The Development of Type Systems for Object‐Oriented Languages

Theory and Practice of Object Systems, 1995

This paper, which is partly tutorial in nature, summarizes some basic research goals in the study and development o f t yped objectoriented programming languages. These include both immediate repairs to problems with existing languages and the long-term development o f more exible and expressive, yet type-safe, approaches to program organization and design. The technical part of the paper is a summary and comparison of three object models from the literature. We conclude by discussing approaches to selected research problems, including changes in the type of a method from super class to sub class and the use of types that give information about the implementations as well as the interfaces of objects. Such implementation types seem essential for adequate typing of binary operations on objects, for example.