Online Manual: Connector-related Expressions

Inside an atomic classage, a few expressions can be used to operate on the connectors defined in the same classage:

We disallow overriding in singleton connectors. Were it to be allowed, an export m serving as the default overridable method might have access to per-connection states and at the same time get invoked by the A::m(e1,...,en) expression. If at the moment the enclosing connector A does not have any connection associated, per-connection state access might lead to problems. Such an issue is avoidable by minor changes in the language design, and a more real reason is we do not see a need for such an operation.

We have written four examples to demonstrate the use of these expressions. The first example revolves around a generative connector, including the use of all the above expressions, when things go smoothly, or when exceptions should be thrown. The second example is similar to the first one, but here the connector in concern is a singleton, which means singleton connector invocation expression is allowed in this scenario. The third example and the fourth example are similar to the first and the second, except that we now consider the correctness of these expressions in a bigger context: when an atomic classage contains any of the aforementioned expressions and is later used in mixing to form bigger compounds, does Classages still work properly? Running these examples will give readers the positive answer. Again, the third example revolves around a generative connector while the fourth one revolves around a singleton.

Typechecking

When expression connect e with P » Q typechecks, it has a type of a connection type P. It fails to typecheck iff

Statement disconnect e does not return a value. It fails to typecheck iff e is not of connection type.

When expression e->m(e1,...,en) typechecks, its type is the same as the return type of the method m. It fails to typecheck iff

When expression m(e1,...,en) within a connector typechecks, its type is the same as the return type of the method m. It fails to typecheck iff

Per-connection states are typechecked in a completely predictable way, the same as local fields.

We have explained the typechecking for the A::m(e1,...,en) expression and forall(p::A) {e} statement when dealing with plugger-related expressions.

A comprehensive example including most of the illegal cases mentioned above is here.