Document call_time_pass_reference

php.internals

Jakub Vrana

22 years ago
Hello! I want to document, why call_time_pass_reference was deprecated by establishing allow_call_time_pass_reference. I assume code cleanliness or performance reasons but I want to document official reason. Jakub Vrana

Derick Rethans

22 years ago
On Wed, 4 Aug 2004, Jakub Vrana wrote:
> Hello! > > I want to document, why call_time_pass_reference was deprecated by > establishing allow_call_time_pass_reference. I assume code cleanliness > or performance reasons but I want to document official reason.
Erm, no. This is wrong :) allow_call_time_pass_reference just disables the warning for now. You should just not pass parameters as a reference but instead specify them as "reference parameter" in the function declaration. Why this is better (except from a cleanliness reason) I can't tell you. Derick

Jakub Vrana

22 years ago
Derick Rethans wrote:
> Erm, no. This is wrong :) allow_call_time_pass_reference just disables > the warning for now. You should just not pass parameters as a reference > but instead specify them as "reference parameter" in the function > declaration.
I know this.
> Why this is better (except from a cleanliness reason) I can't tell > you.
This is what I need to know :-). In php.ini-recommended there is only [Code cleanliness] reason. Jakub Vrana

l0t3k

22 years ago
"Jakub Vrana" <vrana@php.net> wrote in message news:183170577390.20040804114019@vrana.cz...
>>This is what I need to know :-). In php.ini-recommended there is only >>[Code cleanliness] reason.
in other (compiled) programming languages, a function prototype specifies the "contract" between the function and its callers, and makes explicit the programmer's intentions as to how the function is to be called. Usually expected parameter types and passing methods specified by the function as checked at compile-time to ensure that parameters passed to the function are as expected. in specifying a parameter as by-reference, the programmer makes it clear that the function may modify the value of the parameter. In specifying the parameter as by-value, s/he states that the passed in parameter will not reflect any changes when the function returns. This is its "contract" with the caller of the function. However, allowing call_time_pass_reference violates this by bypassing the programmer's explicit intention in not declaring a parameter by reference. l0t3k

Jakub Vrana

22 years ago
l0t3k wrote:
> in other (compiled) programming languages, a function prototype specifies > the "contract" between the function and its callers, and > makes explicit the programmer's intentions as to how the function is to be > called. Usually expected parameter types and passing methods specified by > the function as checked at compile-time to ensure that parameters passed to > the function are as expected. > in specifying a parameter as by-reference, the programmer makes it clear > that the function may modify the value of the parameter. In specifying the > parameter as by-value, s/he states that the passed in parameter will not > reflect any changes when the function returns. This is its "contract" with > the caller of the function. However, allowing call_time_pass_reference > violates this by bypassing the programmer's explicit intention in not > declaring a parameter by reference.
Thanks for thorough explanation. I already thought about it, came to the same conclusion and documented it. Jakub Vrana