Re: [PHP-DEV] Fwd: Re: BYREF_DENY From: Andrei Zmievski (andrei <email protected>)
Date: 12/15/99

On Wed, 15 Dec 1999, Stig Bakken wrote:
> On Tue, 14 Dec 1999, Zeev Suraski wrote:
>
> [Zeev]
> | We're seriously considering stating that this notation will be deprecated
> | in future versions of PHP/Zend. It'll definitely break tons of existing
> | code, which is why we have to be very careful about it, and provide people
> | with automated script checkers and such. What do you think?
>
> [Andrei]
> | I think it's a good idea, even thought it will break existing code. You
> | shouldn't arbitrarily define at the call level whether an argument is
> | passed by reference or by value - that's giving too much power to sloppy
> | programmers.
>
> I disagree. Sometimes the programmer using a function knows better
> whether it makes sense to pass something by reference. The way I read
> this discussion is that you wanted to make the decision of whether the
> argument should be passed by referene done by the called function only. If
> that is the case, consider this a -1. What would be nice though, is a way
> for a function to declare that it always refuses to accept arguments by
> reference. If that is what you meant, consider this a +1 :-)

That is how this discussion started. I asked for BYREF_DENY argument
modifier and Zeev said they've been considering this whole change.

If you write your own functions that you can definitely specify which
argument gets passed by reference. If you use someone else's functions
then you should adhere to their design for the function. In either case
by reference/value passing control seems to be best left to the
programmer who wrote the function, not the one calling it.

If we put in a special symbol to say "refuse passing by reference", I
know I'll have to use it _everywhere_ except for certain cases. Look at
C/C++ for example - the function prototype determines whether you pass
by reference or value.

-Andrei
* There is no knowledge that is not power. *

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>