Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66696 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32137 invoked from network); 19 Mar 2013 08:09:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2013 08:09:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre@pcservice.co.za; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre@pcservice.co.za; sender-id=pass Received-SPF: pass (pb1.pair.com: domain pcservice.co.za designates 67.18.68.4 as permitted sender) X-PHP-List-Original-Sender: pierre@pcservice.co.za X-Host-Fingerprint: 67.18.68.4 gateway13.websitewelcome.com Linux 2.6 Received: from [67.18.68.4] ([67.18.68.4:38330] helo=gateway13.websitewelcome.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 89/B0-28284-43D18415 for ; Tue, 19 Mar 2013 03:09:25 -0500 Received: by gateway13.websitewelcome.com (Postfix, from userid 5007) id 2E129A1681321; Tue, 19 Mar 2013 03:09:15 -0500 (CDT) Received: from vinacomin.websitewelcome.com (vinacomin.websitewelcome.com [50.97.101.199]) by gateway13.websitewelcome.com (Postfix) with ESMTP id 1F475A16812FD for ; Tue, 19 Mar 2013 03:09:15 -0500 (CDT) Received: from [209.85.216.177] (port=44303 helo=mail-qc0-f177.google.com) by vinacomin.websitewelcome.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.80) (envelope-from ) id 1UHrbm-0007lF-0z for internals@lists.php.net; Tue, 19 Mar 2013 03:09:22 -0500 Received: by mail-qc0-f177.google.com with SMTP id u28so83875qcs.36 for ; Tue, 19 Mar 2013 01:09:21 -0700 (PDT) X-Received: by 10.224.108.4 with SMTP id d4mr1254640qap.83.1363680561533; Tue, 19 Mar 2013 01:09:21 -0700 (PDT) MIME-Version: 1.0 Reply-To: pierre@pcservice.co.za Received: by 10.49.129.134 with HTTP; Tue, 19 Mar 2013 01:08:51 -0700 (PDT) In-Reply-To: <4F.50.28284.AA918415@pb1.pair.com> References: <20.05.17382.B0318415@pb1.pair.com> <4F.50.28284.AA918415@pb1.pair.com> Date: Tue, 19 Mar 2013 10:08:51 +0200 Message-ID: To: Bruno CHALOPIN Cc: PHP Development Content-Type: multipart/alternative; boundary=20cf3074b16a751cc904d8429fd6 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-qc0-f177.google.com) [209.85.216.177]:44303 X-Source-Auth: pierre@pcservice.co.za X-Email-Count: 2 X-Source-Cap: cGNzZXJ2aWM7cGllcnJlO3ZpbmFjb21pbi53ZWJzaXRld2VsY29tZS5jb20= Subject: Re: [PHP-DEV] __invokeStatic() method From: pierre@pcservice.co.za (Pierre du Plessis) --20cf3074b16a751cc904d8429fd6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > Le Tue, 19 Mar 2013 09:37:43 +0200, Pierre du Plessis a =E9crit : > > 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, o= r > > invoke the __invokeStatic method if it is available? > > It will clearly technically lead to a problem. Now I don't see why in the > world a class and a function could share the same name. Regarding > conventions, a class name should begin with an uppercase character and a > function a lowercase one. I don't see any relevant use case where a class > and a function should share the same name. > > PHP doesn't care about uppercase or lowercase when it comes to function names. Have a look at http://3v4l.org/cePT5 for an example. And not everybody uses conventions anyway (although they should) Although it is not common to have a class and function have the same name, it can happen. Take the following code as an example. class Debug { public static dump($var) { // some code to debug $var } } function debug($var) { return Debug::dump($var); } The problem is clear if you have a __invokeStatic method in the debug class, and you want to make a call to debug(). --20cf3074b16a751cc904d8429fd6--