Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev <smalys...@sugarcrm.com>
escreveu:

On 9/19/11 2:12 AM, Gustavo Lopes wrote:
Arbitrary as it may be, it's nevertheless reasonably arbitrated given how little useful it is to just ignore arguments and how likely it is to a
mistake.

It is not little useful and it is not likely to make such mistake without immediately being notified and corrected. I don't know how you make these assumptions or what they are based on - could you please bring some evidence?

It would obviously be hard to produce such evidence. Measuring how common
a mistake is very difficult without some study to that effect since those
mistakes are steeply underrepresented in the public PHP code corpus (i.e.
they get fixed). And measuring how common overrides with less arguments
are would still require relatively complex code analysis.

So, no, I cannot prove the assertions behind my argument, I can only say I
believe them to be plausible.

And I don't buy the func_get_args() argument. Why would anyone use
func_get_args for anything other than variadic functions?... I certainly
don't.

So you say if you personally don't use something in PHP nobody should use it? And, BTW, what's wrong with variadic functions (i.e., ones accepting variable number of arguments)? Such functions are commonplace in PHP.

The thing if you introduce func_get_args() to the argument, any discussion
about enforcing signatures becomes meaningless. One could argue this
should be allowed:

class A {
function foo() {}
}

class B extends A {
function foo($a) {}
}

Because for all we know the implementation of A::foo() could have:

function foo() {
        $a = func_get_args()[0];
}

--
Gustavo Lopes

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

Reply via email to