Parameter Declaration
A parameter declaration tells the compiler the name of the function and the number, type and order of parameters utilized in that function. It is a composed of a series of parameters, contained in parenthesis, delimited by commas, with the other identifying information such as type and order. It is sometimes called an argument declaration. The parameter declaration can be contained in either the same source code file along with the function or procedure or it can be contained in a separate file and included in the source code file for the function using some sort of include directive. Parameter declarations are sometimes incorporated into lists such as parameter lists. In these lists parameter declarations are separated by a semicolon.
There are several types of parameter declarations. Two types are constant or value parameter declaration, and variable or a reference parameter declaration. A constant parameter declaration is evaluated at runtime and its actual value is transferred from the caller function to the called module. Unlike a constant parameter declaration a variable parameter declaration is not transferred to the called function but instead only its address is transferred.
Although it is the type of parameter declaration by definition that determines where the parameter is evaluated there are many different conventions for passing parameters to functions and procedures including call-by-value, call-by-name, and call-by-need.
The specific method used to transfer the parameter will affect whether the value of the parameter is computed by the caller or the called function and whether the called function can modify the value of the parameter as seen by the caller, assuming it is a variable. The call-by-value method is an evaluation method where parameters are evaluated before the function or procedure is entered. In this way only the value of the parameter is transferred and so any changes that occur to the parameter in the called function are not seen to affect the parameter by the caller. Although this method is efficient it is less likely to terminate in the presence of infinite data structures and recursive functions. The call-by-name method utilizes a method that passes the parameter as an unevaluated expression. It is the opposite of the call-by-value method. Parameters to macros are usually passed using call-by-name. In order to implement functional programming languages, call-by-name is often combined with graph reduction, a technique that represents an expression as a directed graph, to avoid repeated evaluation of the same expression. This combination is then known as the call-by-need method, the third method mentioned above. This is a method that delays evaluation of function parameters until they are needed because they are parameters to a primitive function or a conditional.
This is the complete article, containing 441 words
(approx. 1 page at 300 words per page).