§2.7.(d) Implicit playedBy specialization
According to §2.1.(d) an implicit sub-role may implicitly specialize an existing playedBy
relation.
This requires the base class to be specified relative to some implicit (OuterTeam.this
) or explicit (OuterTeam.base
) team anchor.
Specializing that team anchor automatically specializes the playedBy declaration, too.
This rule never requires any action from a programmer but only explains the interpretation of a playedBy declaration in
complex situations.
Two advanced examples demonstrating the above are:
- If a role
TOuter1.T.R of a nested team TOuter1.T is played by
another role of the outer enclosing team TOuter1.B , subclassing the outer team TOuter1 to TOuter2
will produce a new role TOuter2.T.R which is automatically played by TOuter2.B ,
an implicit sub class of the original base class TOuter1.B .
|
 |
- Consider the case where a nested
T1 as a role of TOuter is stacked
on a base team TB1 . Also, T1 is a layered team over TB1
because its role R adapts role TB1.B .
In this situation the playedBy relation of role TOuter.T1.R is given by a base-anchored type B<@T1.base> .
If furthermore TOuter.T1 is subclassed to TOuter.T2 which covariantly refines the inherited
playedBy declaration to TB2 , then TOuter.T2.R will automatically refine the inherited playedBy relation
to TB2.B to follow the new interpretation of the base anchor.
|
 |