Delivered-To: zeev@mail.zend.com
Delivered-To: alias-zend-zeev@zend.com
Date: Tue, 14 Dec 1999 15:38:00 -0600
From: Andrei Zmievski <andrei@ispi.net>
To: Zeev Suraski <zeev@zend.com>
Cc: Andi Gutmans <andi@zend.com>
Subject: Re: BYREF_DENY
X-Mailer: Mutt 1.0i
On Tue, 14 Dec 1999, Zeev Suraski wrote:
That's pretty remarkable, I talked to Andi about it today.
I must have tuned in on your brain wavelength.
Generally, if we had our way with it and could change the course of
history, we would completely remove the ability to selectively send
arguments by reference at the function call level. Proper encapsulation
would require the function to decide what arguments should be passed by
reference and which by value, and disallow the user to override it.
Ah, so if the function is declared as foo(&$arg1, $arg2), then that's
the only way you'd be able to pass $arg1 by reference.
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?
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.
As to BYREF_DENY, it depends a bit on what we decide here. I don't think
it's difficult to implement, but the question is whether we want to
introduce it, just so that we'll remove it in a future version.
God, remember all that stuff we went through to make sure that the C
funcitons did not overwrite the argument passed by reference? This would
have made it so much easier. As to adding it now or not, it depends on
what future version you are considering it for.
Perhaps we can already add a 4.0 option to turn off the support for
function-call-level pass-by-reference, and instruct people to test their
code using it.
Yes, PHP is an evolving language and we should actively be thinking
about ways of making it better.
-Andrei
Linux is like living in a teepee.
No Windows, no Gates, Apache in house.
- Usenet signature
--
Zeev Suraski <zeev@zend.com>
http://www.zend.com/