Online Manual: Interface-Renamed Classages

Classages allows programmers to rename classage interfaces (mixers, pluggers or connectors) via the following top-level language construct:

classage X = Y rename P >> Q
which means the newly defined classage X is the same as classage Y, except the interface named P in classage Y is now named Q in X.

The renamed classage can also define its own constructors, in much the same way as in compound classages. For instance,

classage X = Y rename P >> Q
    X() {:Y(); }
    X(int x) { this(); }
}

When a renamed classage does not define its own constructor, a default constructor taking no argument is implicitly defined. However, if any explicit constructor is defined, the default constructor would not be added.

Here is an example demonstrating different cases of renaming classage interfaces.

Well-formedness and Typechecking

An interface-renamed classage classage X = Y rename P » Q fails to typecheck iff:

For interface-renamed classages with explicitly defined constructors, the compiler complains exactly the same way as for the compound classage to rule out ill-defined constructors, which we do not repeat here.

Here is an example to demonstrate how the compiler rejects all programs that fall into the aforementioned conditions.