Online Manual: Atomic Classages
An atomic classage has 6 potential kinds of members: mixers; pluggers (including singleton pluggers); connectors (including singleton connectors); local methods; local fields; constructors. Except constructors, all the aforementioned members have been explained in detail by the paper.
Classage constructors is almost identical to Java's. For instance,
classage X {
X() { some code here }
X(int x) { this(); }
}
denotes X has two constructors, distinguishable different
argument types. The second constructor invokes the first constructor
via a ``this'' constructor call, where this is a
keyword.
When an atomic 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.
Well-formedness and Typechecking
Beyond the grammatical constraints every atomic classage must conform to - for instance a plugger or a mixer can not define per-connection states inside - an atomic classage fails to typecheck iff any of the following condition is met:
- duplication of classage members. This happens when within one classage, two classage interfaces share the same name, or two local methods share the same name (we do not support method overloading for now), or two local fields share the same name, or two constructors having identical signatures.
- duplication of classage interface members. This happens when within one classage interface, two imports share the same name, or two exports share the same name, or two per-connection states share the same name.
- meaningless overriding: Classages does not allow a method being declared both as an export and as an import (overriding with default implementation) in generative pluggers, generative connectors, and singleton connectors. The first two are disallowed out of its meaninglessness: since they can only be used after a plugging/connection is established, the default case would never be invoked anyway. The third case is disallowed because a connector might be stateful: a hapless invocation to a default export might lead to access to uninitialized states.
- mismatched overriding: for mixers and singleton pluggers, if a method is declared as both an export and an import, the export method must have a more specialized signature than the import method (i.e. satisfying a subtyping property). (Here is a simple test case.)
- ill-defined constructors: An atomic classage constructor is
ill-defined iff the constructor has a name
different from its enclosing classage, or if in the body of a
constructor, a ``this'' constructor call is issued but not at the
beginning of the body, or if the arguments taken by
the ``this'' constructor call does not have types that can result in
locating the unique most specific constructor, in the same way as
Java's lookup for the right constructor (see JLS
15.11.2.2). (Here
is a simple
test case.)