SIMPOL Documentation

Function References (Pointers)

SIMPOL supports the concept of function references, so it is completely permissable to declare a variable of type function, then assign a reference to a function to the variable, and finally use the variable to call the function that is referenced. This provides a powerful mechanism for writing generic code that can allow function references as parameters enabling functions to be written that pass off the responsibility for certain operations to functions that are defined by the caller. The caller can pass these functions as references. An traditional example of this would be a sort function that takes a comparison function as a parameter. The sort function only needs to be able to manipulate the contents of the array, it does not need to know how to compare the members.