J&: Language-Based Extensibility and Adaptation
The goal of the J& project is a type-safe programming language that makes code reuse easier, safer, and more powerful. In conventional languages, extending a large, complex system requires either duplicating code or writing boilerplate or glue code. Making a large system extensible requires intrusive and tedious design patterns. Writing and maintaining code is difficult and tedious. Our goal is type-safe, modular, scalable extensibility: the work required to modularly add a new feature should be proportional to the size of the feature, and extensions should be unable to cause type errors.
J& (pronounced “jet”) is an extension of Java that increases code extensibility and reuse using nested inheritance. Nested inheritance supports inheritance of packages and classes while allowing classes nested within to be overridden. Nested inheritance is a powerful mechanism for safely and modularly extending code.
J& is an outgrowth of work on the Polyglot extensible compiler framework. Polyglot has been ported to J&. An earlier version of the language was known as Jx.
An initial release of the J& compiler is now available, released October 2006. It supports nested inheritance and intersection.
Versions of J& supporting different flavors of family-level sharing have been implemented but have not yet been released publicly.
Papers and reports
The development of J& has been supported by a number of funding sources, including DARPA Contract F30602-99-1-0533, monitored by USAF Rome Laboratory, ONR Grant N00014-01-1-0968, NSF Grants CNS-0208642, CNS-0430161, and CCF-0133302, an Alfred P. Sloan Research Fellowship, and an Intel Research Ph.D. Fellowship.
Example: Composing compilers with nested intersection.
The base compiler package is extended in two different ways using inheritance, adding new classes and class members (bold) in the subpackages pair and sum, which implement extended compilers. When intersected in the package pair & sum, the class hierarchies contained in the two packages are composed. The resulting compiler incorporates both language extensions.