Overlapping function
A overlapping function or function interns is a function encapsulated in another. It can be called only by the including function or functions imbricated directly or not in the same function including. In other words, the carried of the overlapping function is limited by the including function.
an example with the syntax of Pascal: function E (X: integer): integer function F (there: integer): integer begin F: = X + there end begin E: = F (3) end
And the same example with a syntax way C:
int E (int X) { int F (int there) { return X + there; } return F (3); }
The function F is overlapping in E (note that x is visible in F, but y is invisible apart from F).
The overlapping functions are a form of encapsulation and are used to divide procedural tasks in sub-tasks which have significance only local. It makes it possible to avoid the pollution of the total space of names by names of functions, variables… of which the use is restricted at a small portion of the program.
Among the most known languages which support the imbricated functions, there is
- Algol, Pascal, Ada, Scheme, Common Lisp, Python, D and Perl.
In Design and majority of the functional languages, the overlapping functions are a common manner to establish functions comprising of the loops. A simple overlapping function recursive or final recursion is created, who behaves as the principal loop, whereas the including function carries out the actions which must be to me made that once. In the more complex cases, several mutually recursive functions can be created like overlapping functions.
See too
- circular Reference
- Pile of call
| Random links: | Corot (satellite) | Schwarzlose MG M.07/12 | Šišatovac | Bonkers (televised series) | 1973 in classical music | Baronnie_de_Tabria |