Previous: , Up: Implicit Conversions   [Index]


3.13.2 Application Defined Implicit Conversions

The application may define itself a set of conversions to be applied to data so that it fits the required type. The conversions are inserted as prefix unary operators or single parameter functions in the parsed expression representation, at parse time.

See Functions.

See Prefix Unary Operators.

The operators and functions making the conversion need not be available as regular operators and functions and are only looked up in the implicit conversion contexts and by specific means.

The application defined implicit conversions are of limited use. For first, they only apply in certain scopes, such as function argument type fitting (and only for non reference arguments).

The converter sets are introduced to the expression parser (just like other sets) as context pointer / look up method pairs. When the type of the subexpression making the argument of some function fails to match its respective function parameter type, the expression parser will automatically insert a prefix unary operator converter if the two mismatching types belong to the set of intrinsic scalar types.

See Implicit Conversion For Scalar Types.

If such course is not available, the expression parser will look for an application defined prefix unary operator converter from the subexpression type to the function parameter required type. If such an converter is not available, the expression parser will look for one supported by a single parameter function.

The prefix unary operator supported converters are evaluated faster, while the single parameter function supported ones are more powerful. The converter functions may define, just like regular functions, specific execution contexts, i.e. they may associate data.

See Per Function Execution Context.

See Of Functions And Operators.


Previous: , Up: Implicit Conversions   [Index]