Next: , Previous: , Up: Expression Evaluator   [Index]


3.6 Function Pointers

Function pointers are function hints, values indicative of functions. They may be used instead of functions, the functions that they hint (point, indicate) may be called through them.

Function pointers do not refer a memory region, and in this respect they are not similar to the C function pointers. They are in other respects much like the C function pointers.

Functions themselves may be taken as constant function pointer variables, though the analogy has limitations.

As values, function pointers have types. Such types uniquely identify the function (return) type and the types of the function arguments. A function pointer thus describe the (return) type and the types of the arguments of the function it hints.

Function pointers hinting of functions of the same (return) type and types of parameters have the same type. Conversely, if they hint function of different (return) types or types of parameters, they have different types.

As values, function pointers may be passed as parameters, stored by variables, etc.

Function arguments may have function pointer types. Function (return)s may have function pointer types. Variables may have function pointer types.

The call syntax of the functions hinted by function pointers is the same as the function call syntax, only instead of the function name a function pointer is specified instead. The function pointer itself may be the value of a variable or of a function call.

For the application, the type ids of function pointers are integer values, just as are all the aime data type ids. The mapping between the integer values and the function (return) type and list of argument types is done by an (expression evaluator) external entity. One such mapping entity is to be provided for the expression evaluator by the application.


Next: Prefix Unary Operators, Previous: Mathematical And Text Generalities Functions, Up: Expression Evaluator   [Index]