Next: , Previous: , Up: More Of Operators   [Index]


3.12.2 Expressive Operators

Operators are crude version of functions, featuring simple definitions that allow for faster execution. Most of the times this is exactly what is required, except of course for the times where performance considerations are dubious, the function features are really required and the operator syntax is much preferred. Such is case for assignment operations for complex types, where the operator syntax is the natural one and accessing function features such as function specific execution contexts is strictly required.

See Of Functions And Operators.

See Per Function Execution Context.

The expression evaluator offers to replace operator calls with function calls to cover for lacks of functionality in the operator definition.

Operators that are to be replaced should be marked as such, and a replacing function definition should be attached to them. The indications are allowed in the operator second extension, the one struct x1f4_2ndscope_type record pointed to by the extension2 field of the struct x1f4_operator_type definition.

See struct x1f4_operator_type.

See struct x1f4_2ndscope_type.

The extension is observed if the X1f4_E4_E2ND_LINK bit is included in the value of the flags attribute of the operator definition.

See Operator Flags.

The replacing function struct x1f4_linetext_type definition is to be pointed to by the line attribute of the struct x1f4_2ndscope_type operator extension scope.

See struct x1f4_linetext_type.

The X1f4_E4_CALL_LINK bit should be included in the value of the bits field of the struct x1f4_2ndscope_type record to indicate that the operator to function substitution should be performed.

See Operator Second Extension Scope Flags.

The operator to function replacement is done right after parsing and before any expression optimization. As such, the arguments must match exactly their respective types in the operator definition. Also, no operator optimization will be carried out.

The definition of the replacing function should match the definition of the operator: the number and type of the parameters should match, the function should not have side effects that are not flagged by its introducing definition and its definition should not flag side effects that are not flagged by the operator definition. The function should not modify its arguments, except possibly the first one and only when indicating so. If it does, the operator definition should also indicate that the first argument is modified.

Operator replacing function definitions should not set X1f4_E4_LEAD_CALL or X1f4_E4_WALK_LINK.

See Pass By Reference.

See Side Effects Operators.


Next: Ambiguous Operators Sets, Previous: Operator Character Set, Up: More Of Operators   [Index]