modula-2 home

  Win32 API  


Procedure Calls

A procedure call serves to activate a procedure. The procedure call may contain a list of actual parameters which are substituted in place of their corresponding formal parameters defined in the procedure declaration. The correspondence is established by the positions of the parameters in the lists of actual and formal parameters respectively. There exist two kinds of parameters: variable and value parameters.

In the case of variable parameters, the actual parameter must be a designator denoting a variable. If it designates a component of a structured variable, the selector is evaluated when the formal/actual parameter substitution takes place, i.e. before the execution of the procedure. If the parameter is a value parameter, the corresponding actual parameter must be an expression. This expression is evaluated prior to the procedure activation, and the resulting value is assigned to the formal parameter which now constitutes a local variable. The types of corresponding actual and formal parameters must be identical in the case of variable parameters, or assignment compatible in the case of value parameters.

   ProcedureCall = designator [ActualParameters].

Examples of procedure calls:

   Write(j*2 + 1 , 6)


  • Wirth N: Programming in Modula-2, 3rd ed. Springer Verlag, Berlin, 1985.