Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40557 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63877 invoked from network); 18 Sep 2008 19:42:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2008 19:42:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=ionut.stan@yahoo.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ionut.stan@yahoo.com; sender-id=unknown; domainkeys=good Received-SPF: error (pb1.pair.com: domain yahoo.com from 209.191.91.200 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ionut.stan@yahoo.com X-Host-Fingerprint: 209.191.91.200 web36408.mail.mud.yahoo.com Received: from [209.191.91.200] ([209.191.91.200:29493] helo=web36408.mail.mud.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3D/E1-54234-43FA2D84 for ; Thu, 18 Sep 2008 15:42:45 -0400 Received: (qmail 81035 invoked by uid 60001); 18 Sep 2008 19:42:42 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Message-ID; b=BH8F3Rtm76iTByMC7srg1U0eqauurRi5WwokcAAf91+NZ8zPxSsNTY6kiur9X7HaFsJIyrVsFVmeoFtAthVsV+cMLx/oM7AAqVwZzmLw20Mq1enGz8a2HfyQAVWCGWR644ClzJvKbVNK3Pi6xYCWuJ2Hx8C7gdiiuAC6PEQEzMc=; X-YMail-OSG: uiA3.rsVM1l8q2PB9WU4rtHVBweDdJCH.BIuHMjd5wYOaSq7puqSen6fdvbVin2sW.CYaa.MBaho7ESJ9nv6JXEMc809GUsjyIlJz.8yh3vITjmGMjJTg_7.Cvq0WdVj2UtP91crtEKVUAY1A.0w8wCOvbw- Received: from [86.106.195.153] by web36408.mail.mud.yahoo.com via HTTP; Thu, 18 Sep 2008 12:42:42 PDT X-Mailer: YahooMailRC/1096.28 YahooMailWebService/0.7.218.2 Date: Thu, 18 Sep 2008 12:42:42 -0700 (PDT) To: Gregory Beaver Cc: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <532220.80018.qm@web36408.mail.mud.yahoo.com> Subject: Re: [PHP-DEV] Re: Namespaced function vs static method in global class From: ionut.stan@yahoo.com (Ionut Gabriel Stan) Thanks for your answer guys, they answered my questions. Hopefully any introduction in the language of a __getStatic() and __setStatic() won't make things even more confusing. Thanks also for the effort you put in developing PHP, I really appreciate it. Cheers, I. Stan ----- Original Message ---- From: Gregory Beaver To: Ionut Gabriel Stan Cc: internals@lists.php.net Sent: Wednesday, September 17, 2008 7:25:31 AM Subject: [PHP-DEV] Re: Namespaced function vs static method in global class Ionut Gabriel Stan wrote: > echo Test::foo(); // outputs namespace function > echo '
'; > echo ::Test::foo(); // outputs namespace function > My questions are: > > 1. How should I call the static method foo in the global class Test (except for call_user_func) > 2. How should I call the static method baz of class Bar in namespace Test with call_user_func > 3. Is there no possibility to change your minds and replace the double colon with something else, likes a simple colon? I find it very confusing to figure out what is what and the way I should call it. Hi Ionut, Stas did a good job of answering how to call the static method using call_user_func. The answer to #1 under the current implementation is "you can't" which is why I posted a patch to allow differentiating between the two earlier this week. However, I have since discovered a much better solution, and have a working patch, but am checking details offlist before I propose it, as it involves a slight but important change to namespace syntax. Stay tuned for further details. As for your 3rd question, I guarantee this will not happen, as it is technically impossible to do. For instance: switch ($something) { case oops: is:this:part:of:oops(); break; } The above code could resolve to either "case oops:" followed by "is:this:part:of:oops()" or as "case oops:is:this:part:of:oops()" and there is no way for a computer to tell the difference without introducing required whitespace. Since PHP != Python, that won't happen :). Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php