On Feb 2, 2004, at 2:39 PM, Andi Gutmans wrote:


At 07:32 PM 2/2/2004 +0100, Ferdinand Beyer wrote:
On 2 Feb 2004 at 14:36, Zeev Suraski wrote:

> Clone methods must now be declared as follows:
> function __clone($that)
> {
> }

I just had a look at zend_compile.c - it seems as if the variable name
$that was mandantory:

[...]
 || strcmp(CG(active_op_array)->arg_info[0].name, "that")!=0)) {
                  zend_error(E_COMPILE_ERROR, "The clone method
must be declared as __clone($that)");
[...]

Why shouldn't I be able to name it as I want, e.g. $clone? Don't
understand the reason for that...

Because we want to keep it standard so that everyone uses the same thing (like previously).
Anyway, $clone is semantically wrong because it implies that is the cloned object and not the to-be-cloned object.

If you force the parameter to be name $that, what's the point of requiring it to be passed at all? Seems analogous to having all methods be required to pass $this as their first parameter.


George

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to