Next: , Previous: , Up: Procedural Language Interpreter   [Index]

6.12 Procedural Temporaries

Temporaries disposal for procedural programs execution is to be carried largely as for imperative programs execution. Extra complexity is required around calls of program defined functions.

See Temporaries.

The extra complexity derives from the control reverting to the application during the execution such calls. If temporaries were created before the function calls and they are to persist beyond the function calls, extra care must be taken not to free the temporaries (still in use, still not out of scope).

See Step By Step Procedural Program Execution Rationale.

Consider such a statement:

cat(itoa(13), itoa(f()));

where ‘cat’ and ‘itoa’ are temporaries generators as defined by the libaime text library and ‘f’ is a program defined procedure returning some integer data.

See Text Functions.

The application may attempt to free the temporaries created by the first ‘itoa’ call first time given the chance. And that will be for the first executed statement of the ‘f’ procedure. Only the temporaries ‘itoa’ created are still very much in use.

A solution for proper temporaries disposal should be fairly easily engineered by making use of the introduced function call observability.

See Call Observers.

libaime provides such a solution, a simple minded procedural temporaries disposal mechanism.

See Hierarchical Resource Allocation Manager.