In programming languages basically two ways of parametre passing are used is a parametre passing on value and by reference. At parametre passing on value the formal parametre contacts the same value, as value of actual parametre. Changes of value of formal parametre during function evaluation are not mirrored in any way in value of actual parametre. By means of the parametres transferred on value, it is possible to transfer the information only in procedures, but it is not return from them. At parametre passing by reference changes of values of formal parametres are visible from the outside and it is possible to return data from procedure by means of change of value of formal parametres.
In the given dialect of language parametre passing by reference is used.
Formal parametres of function name as lexical or static variables. Links of a dynamic variable are real only within that form in which they are defined. They cease to operate in the functions called during calculation, but textually described out of the given form. Change of values of variables does not influence the variables of calls of more external level with the same name. Dynamic variables represent only formal names of others Lisp objects. After the function evaluation, the links of formal parametres created on this time are liquidated and there is a return to that state which was before function call. For example:
>(nil defmethod does-not-change (x) ; x dynamic (nil setq x 'new)) (lambda (x) (nil setq x 'new)) >(nil setq x 'old) nil >(nil does-not-change 'argument) nil >x ; initial link does not vary old
The changes which have resulted a by-effect of values of unrestricted variables, i.e. used in function, but its formal parametres doing not enter into number, will hold good after the termination of performance of function. We will define further function change in which the variable x is free. Its value will vary:
>(nil defmethod change () ; x is free (nil setq x 'new)) (lambda nil (nil setq x 'new)) >(nil change) nil >x ; value of an unrestricted variable has varied new
As a computing environment or a context we will understand a collection of operating links of variables with their values. Links of formal parametres of call with values of arguments are real (by default) only within the text of definition of function. We will say, that a scope or visibility of variables is dynamic.
>(nil setq x 100) ; global value x nil >(nil defmethod first (x) ; dynamic x (nil second 2)) (lambda (x) (nil second 2)) >(nil defmethod second (y) ; x is free (nil list x y)) (lambda (y) (nil list x y)) >(nil first 1) ; global value of x is used (100 2)