↑ Table of Contents ↑ | §2.3.2.(b) Super in the context of declared lifting >> |
§2.3.2.(a) Parameters with declared lifting
A non-static team-level method or constructor may declare a parameter with two types in order to explicitly denote a place of lifting. Using the syntax
public void m (BaseClass as RoleClass param) { stmts }
a liftable parameter can be declared, provided the second type
(RoleClass
) is a role of (playedBy
) the first type (BaseClass
).
Furthermore, the role type must be a role of the enclosing team class defining the given method.
The role type must be given by its simple (i.e., unqualified) name.
Such a signature requires the caller to provide a base object (here BaseClass
), but
the callee receives a role object (here RoleClass
).
In fact, the client sees a signature in which the "as RoleClass
" part is omitted.
Compatibility between caller and callee sides is achieved by an implicitly inserted lifting translation.
A signature using declared lifting is only valid, if the requested lifting is possible
(see §2.3.3 and §2.3.4 for details).
↑ Table of Contents ↑ | §2.3.2.(b) Super in the context of declared lifting >> |