Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66694 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28365 invoked from network); 19 Mar 2013 07:38:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2013 07:38:18 -0000 Authentication-Results: pb1.pair.com header.from=pierre@pcservice.co.za; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre@pcservice.co.za; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain pcservice.co.za designates 67.18.44.21 as permitted sender) X-PHP-List-Original-Sender: pierre@pcservice.co.za X-Host-Fingerprint: 67.18.44.21 gateway12.websitewelcome.com Linux 2.6 Received: from [67.18.44.21] ([67.18.44.21:44323] helo=gateway12.websitewelcome.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/00-28284-9E518415 for ; Tue, 19 Mar 2013 02:38:18 -0500 Received: by gateway12.websitewelcome.com (Postfix, from userid 5007) id C4CF77D50CFCA; Tue, 19 Mar 2013 02:38:14 -0500 (CDT) Received: from vinacomin.websitewelcome.com (vinacomin.websitewelcome.com [50.97.101.199]) by gateway12.websitewelcome.com (Postfix) with ESMTP id A94527D50CF85 for ; Tue, 19 Mar 2013 02:38:14 -0500 (CDT) Received: from [209.85.216.47] (port=59985 helo=mail-qa0-f47.google.com) by vinacomin.websitewelcome.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.80) (envelope-from ) id 1UHr7e-0006Zf-HE for internals@lists.php.net; Tue, 19 Mar 2013 02:38:14 -0500 Received: by mail-qa0-f47.google.com with SMTP id j8so2203339qah.20 for ; Tue, 19 Mar 2013 00:38:13 -0700 (PDT) X-Received: by 10.224.104.201 with SMTP id q9mr1312258qao.39.1363678693882; Tue, 19 Mar 2013 00:38:13 -0700 (PDT) MIME-Version: 1.0 Reply-To: pierre@pcservice.co.za Received: by 10.49.129.134 with HTTP; Tue, 19 Mar 2013 00:37:43 -0700 (PDT) In-Reply-To: <20.05.17382.B0318415@pb1.pair.com> References: <20.05.17382.B0318415@pb1.pair.com> Date: Tue, 19 Mar 2013 09:37:43 +0200 Message-ID: To: Bruno CHALOPIN Cc: PHP Development Content-Type: multipart/alternative; boundary=bcaec53f92252303a004d8423086 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vinacomin.websitewelcome.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pcservice.co.za X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (mail-qa0-f47.google.com) [209.85.216.47]:59985 X-Source-Auth: pierre@pcservice.co.za X-Email-Count: 1 X-Source-Cap: cGNzZXJ2aWM7cGllcnJlO3ZpbmFjb21pbi53ZWJzaXRld2VsY29tZS5jb20= Subject: Re: [PHP-DEV] __invokeStatic() method From: pierre@pcservice.co.za (Pierre du Plessis) --bcaec53f92252303a004d8423086 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > Hi, > > Le Mon, 18 Mar 2013 09:07:43 +0200, Mat=C4=ABss Roberts Treinis a =C3=A9c= rit : > > Not only that. This potentially might break compatibility with many > > software products already out there. > > I don't see how it could break existing software as it is not a > modification of an existing method but a brand new one. > It would break existing software if you have a class and function with the same name. Consider the following example: class foo { } function foo() { } Now what if you have several calls to foo() in your existing application? With the new change, will those calls call the function, or invoke the __invokeStatic method if it is available? > > > Also, this might lead to many > > misunderstandings and, in fact, ambiguous code. Consider the sample. > > > > $name =3D 'something'; > > $something =3D $name(); // What is this - a function call or object? > > > > Fact is, we can not know that unless a) do a search in code b) var_dump= ? > > As long as you use syntax like $foo =3D new $bar() or $foo =3D $bar(), yo= u'll > always wonder if the function/class behind $bar exist or not, etc... > And it is easy to remove any ambiguity by using $something =3D $functionN= ame > () or $something =3D $className() or add proper comments. It's only up to > the dev. > > I find that __invokeStatic() could be a quite cool syntactic sugar. > > My 2 cents. > > Bruno I'm not against the function, just the implementation of it. __invokeStatic might be useful in some (rare) cases, but I don't think the proposed syntax will work. Also I'm sure that most use cases can anyway be solved by using the __callStatic method --bcaec53f92252303a004d8423086--