next up previous contents
Next: Aggregates Up: Expressions Previous: Bound Methods

Coercions and Overloading Resolution

  For uniquely indicating the type of an aggregate of a value type or the value of a primary it may be prefixed with the type in a coercion. Coercing a value v of type T to type T' is legal if any of the following holds: In general, a coercion is only reinterpreting the given value in the sense of its type. A value of a numeric type, including the universal numeric types is coerced to another numeric type by converting integer values to floating point values and adapting the length if necessary. Rounding from floating point numbers to lower precision or to integers must always be specified by explicit operations.

The resulting expression has exactly the type of the coercion. Hence, in overloading resolution no further conformance is checked.

A coercion is automatically inferred in the following cases:

Applied occurrences of overloaded identifiers are resolved as follows:

  1. If the applied occurrence is accompanied by arguments then the number, types and kinds of the arguments are used for determining the set of applicable feature definitions. If the feature belongs to a class C specified by a generic parameter T and T was declared with a typebound T < D then only the features in D are considered.
  2. If multiple features are applicable, then numeric arguments including universal types are coerced to the first type in the schemes tex2html_wrap_inline2549 , and tex2html_wrap_inline2551 that can represent the value and for which an applicable feature exists.
  3. An overloaded feature may not have private as well as non-private variants.
The program is illegal if
next up previous contents
Next: Aggregates Up: Expressions Previous: Bound Methods

Martin Trapp
Mon Feb 17 16:49:16 MET 1997