Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55530 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43843 invoked from network); 19 Sep 2011 09:30:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2011 09:30:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:61114] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/D9-14600-DCB077E4 for ; Mon, 19 Sep 2011 05:30:54 -0400 Received: by ywa8 with SMTP id 8so4648023ywa.29 for ; Mon, 19 Sep 2011 02:30:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=LKQup3iWS2A6WquY4OuJ7WVIIJrNst4j5Ew3IiW4TiM=; b=YA27l/LirzEn1atT5fW85pZzNdjXABZMBMqfUyVISYeUJuSw0iVE8uZZvjlkkLP670 ZJXfjQ0MPwJZUtVpJgbG+HFyButwnRKQmMjua66hqfdexgdM/UY0hk5OUNOmYCb+3Bf8 er5Da8dURbReCX/gHJl0/gXvmzDpfyvgnz48Q= MIME-Version: 1.0 Received: by 10.236.180.67 with SMTP id i43mr12157182yhm.96.1316424648327; Mon, 19 Sep 2011 02:30:48 -0700 (PDT) Received: by 10.147.125.13 with HTTP; Mon, 19 Sep 2011 02:30:48 -0700 (PDT) In-Reply-To: References: <4E74E5A0.2030006@sugarcrm.com> <4E76320F.6010904@sugarcrm.com> <4E764137.9080507@sugarcrm.com> Date: Mon, 19 Sep 2011 11:30:48 +0200 Message-ID: To: Gustavo Lopes Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] __constructor parameter limitations. From: tyra3l@gmail.com (Ferenc Kovacs) On Mon, Sep 19, 2011 at 11:12 AM, Gustavo Lopes wr= ote: > Em Mon, 19 Sep 2011 10:01:32 +0100, Etienne Kneuss > 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 { >> =C2=A0 public function plop() { >> =C2=A0 =C2=A0 =C2=A0$args =3D func_get_args(); >> =C2=A0 =C2=A0 =C2=A0// ... >> =C2=A0 } >> } >> >> This is perfectly valid PHP code, there is no valid usage of Foo that wi= ll >> 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. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu