Online Manual: Plugger-related Expressions

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

We have written four examples to demonstrate the use of these expressions. The first example revolves around a generative plugger, 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 plugger in concern is a singleton, which means singleton plugger invocation expression is allowed in this scenario, and there are important cases such as to demonstrate the correctness of dynamic overriding. 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 plugger while the fourth one revolves around a singleton.

Typechecking

When expression plugin A with P » Q typechecks, it has a type of a plug type P. It fails to typecheck iff

Statement unplug e does not return a value. It fails to typecheck iff e is not of plug 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 A::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 plugger typechecks, its type is the same as the return type of the method m. It fails to typecheck iff

Statement forall(p::A) {e} does not return a value. It fails to typecheck iff

For all the three invocation expressions (plugging invocation, singleton plugger invocation and passive invocation), an extra note is when method m is both an export and an import in the plugger (the overriding case with default implementation). If the import and the export have different signatures (the export one being more specialized according to the well-formedness of classages), the signature applied for typechecking the invocations should be the import one to ensure type soundness.

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