Skip to main content
Article thumbnail
Location of Repository

A Design for Type-Directed Programming in Java \Lambda (Extended Version)



Abstract Type-directed programming is an important and widely used paradigm in the design of software. With this form of programming, a program may analyze type information to determine its behavior. By analyzing the structure of data, many operations, such as serialization, cloning, structural equality, and iterators, may be defined once, for all types of data. The benefit of type-directed programming is that as software evolves, operations need not be updated--they will automatically adapt to new data forms. Otherwise, each of these operations must be individually redefined for each type of data, forcing programmers to revisit the same program logic many times during a program's lifetime. The support for type-directed programming in the Java language includes the instanceof operator and the Java Reflection API. These mechanisms allow Java programs to depend on the run-time classes of objects. However, these mechanisms are difficult to use correctly and require needless casting. They also do not integrate well with generics. In this paper, we describe the design of several expressive new mechanisms for type-directed programming in Java. Our new mechanisms are based on an extension of Java with first-class types (such as NextGen), so they naturally include support for generics. Because these new mechanisms analyze first-class type information directly, instead of examining the run-time class of objects, they can provide strong guarantees about program correctness. Furthermore, our new mechanisms are based on pattern matching, so they naturally and succinctly express many type-directed algorithms.

Year: 2004
OAI identifier: oai:CiteSeerX.psu:
Provided by: CiteSeerX
Download PDF:
Sorry, we are unable to provide the full text but you may find it at the following location(s):
  • (external link)
  • (external link)
  • Suggested articles

    To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.