passbyname
Pass by name is a parameter passing mechanism used in some programming languages, most notably ALGOL. In pass by name, when a function is called, the identifier (name) of the argument is passed to the function. When the function's parameter is referenced, the argument expression is evaluated in the context of the caller, not the function. This means that the argument is evaluated every time it is used within the function. This can lead to unexpected behavior if the argument's value changes between evaluations, or if the argument involves side effects. For example, if an argument is a variable and the function modifies that variable, the change will be reflected in the caller's scope. Conversely, if the argument is an expression, it will be re-evaluated each time the parameter is accessed. Pass by name is distinct from pass by value, where a copy of the argument's value is passed, and pass by reference, where a reference to the argument's memory location is passed. Due to its complexity and potential for confusion, pass by name is rarely implemented in modern programming languages.