SIMPOL Documentation

Functions

In SIMPOL functions are also a data type. It is perfectly reasonable to create a variable of type function that can then be used as a reference to a function. In fact, in some of the functionality provided with SIMPOL, such as tcpsocketserver it is necessary to provide a function reference so that the server knows which function to call when a socket connection is made.

Although that may seem to present considerable complexity, using function references is typically not necessary for programming with SIMPOL, other than when working with events, but the existence of this capability is one of the facilities that allows advanced programmers to create highly sophisticated programs. By using function references, it is possible to assign a display function to a function reference based on the type of the data that is to be displayed, and then just call the display function using the function reference. This makes for very clear and easy to read program code and moves the functionality of how to display a given data type out of the main program and into a function where it can also be reused.