## §4.5 Lifting and lowering

For basic definition see §2.2 and §2.3.
(The following rules are reverse forms of those from §3.3)

#### (a) Call target translation

Invoking a role method due to a callin binding first lifts the base object to the role class of the callin binding, in order to obtain the effective call target. This is why callin bindings cannot be defined in roles that are unliftable due to potential binding ambiguity (see §4.1.(b) above and §2.3.4.(a)).

#### (b) Parameter translation

During callin execution, each parameter for which the role method expects a role object is implicitly lifted to the declared role class.

#### (c) Result translation

Returning a role object from a callin method implicitly lowers this object.

#### (d) Typing rules

A parameter mapping (implicit by parameter position or explicit by a `with` clause) is well typed if the right hand side conforms to the left hand side, either by

- type equality
- implicit primitive type conversion
- subtype polymorphism
- translation polymorphism, here: lifting;
  however, within `replace` bindings step 1 of the smart lifting algorithm (§2.3.3.(a)) is not applicable
- or by a combination of the above.

A result mapping (implicit or explicit by a `with` clause) is well typed, if the value at the left hand conforms to the right hand side according to the rules given above, except that translation polymorphism here applies lowering instead of lifting.

These rules define translation polymorphism as introduced in §2.3.

Additionally, in a `replace` callin binding compatibility of parameters and return types must hold in both directions. Thus, from the above list of conversions a replace binding cannot apply subtype polymorphism nor primitive type conversion. If more flexibility is desired, type parameters can be used as defined in §4.10.

#### (e) Role arrays

For arrays of roles as parameters §2.3.(d) applies accordingly. For arrays as return value §2.2.(e) applies.

#### (f) Base calls

For base calls these rules are reversed again, i.e., a base call behaves like a callout binding.