I am writing a documentation for a programm where a function is defined and it is called three times. I call the definition of the function “function definition”. But what is the correct term for the three executions of a function?
I have read the term incarnation. However this name only appears, when the function is called recursivley.
7
Depending on what you mean exactly, you could be talking about:
- Function call: this is about the process and not any object in memory.
- Stack frame: the technical nitty-gritty details about how information about which function is called with which arguments is stored on the call stack.
- Function invocation: a synonym for function call, but I recall seeing it used in a way where it refers to a conceptual (or actual) object that represents said function call.
You have one of the potential solutions in your question ;-).
The terms of call and invocation are synonymous and mean the point where you use the name of the function to get it executed. Here a quote in The theory and practice of compiler writing by Tremblay&Sorenson, where they speak about programming language syntax for procedures that return or not values:
For this reason, some language designers have inteoduced a special keyword (e.g. call) to clearly delinate the two types of procedure invocations.
At run time when the function is called, it is executed. Two calls in the source code mean two distinct executions. One call in a loop means n executions. Another term that is also used is activation. Here another quote in the same book, when they speak about run-time control flow, and stack management in the case of a recursive function:
(…) the return from that particular activation of FACTORIAL is the point of invocation within FACTORIAL (…)
(note the wording “point of invocation” to mean the place where the function is called).
Conclusion: In your documentation you should use “execution” exactly as you did in your question. “Activation” could be another alternative, but it is less common than “execution” (except for UML designers that use the term in several diagram to mean the start of execution in some context) and could therefore create some ambiguity. If you do not feel comfortable with “execution” you may consider “execution occurence”. It’s not a formal term bu the “occurence” helps to delineate from the general execution of the software.