On Mon, Sep 19, 2011 at 11:12 AM, Gustavo Lopes <glo...@nebm.ist.utl.pt> wrote:
> Em Mon, 19 Sep 2011 10:01:32 +0100, Etienne Kneuss <col...@php.net>
> escreveu:
>
>> Sure, but you mix two things here, references would have to be handled
>> specifically, and we would not allow to specify less args by ref.
>>
>> There is simply no reason for disallowing this with nornal args though.
>> Imagine the following code:
>>
>> interface Foo { public function plop ($a,$b,$c,$d) }
>>
>> class A implements Foo {
>>   public function plop() {
>>      $args = func_get_args();
>>      // ...
>>   }
>> }
>>
>> This is perfectly valid PHP code, there is no valid usage of Foo that will
>> not work with A... So to me this restriction seems really arbitrary.
>> And I don;t believe missing an argument in the declaration of a method,
>> using it in the body of the method and not realising it is so much of a
>> common error that it would warrant this.
>>
>
> 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.
>
> 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.
>

Lester mentioned another use-case, when the Subclass will call the
parent method with constant values as arguments.
For example I have Quadrilateral Superclass with the public function
__construct($width, $height){}
If I create a more special Subclass: Square, I can omit the second
parameter, as I know that for Square, the $width and $height is equal.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

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

Reply via email to