Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40822 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18309 invoked from network); 1 Oct 2008 16:56:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Oct 2008 16:56:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=jochem@iamjochem.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jochem@iamjochem.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain iamjochem.com from 194.109.193.121 cause and error) X-PHP-List-Original-Sender: jochem@iamjochem.com X-Host-Fingerprint: 194.109.193.121 mx1.moulin.nl Linux 2.6 Received: from [194.109.193.121] ([194.109.193.121:51330] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/C6-04812-0BBA3E84 for ; Wed, 01 Oct 2008 12:56:18 -0400 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id CA9FD27E926; Wed, 1 Oct 2008 18:56:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at moulin.nl Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (mx1.moulin.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q-OR9Cz4Nixh; Wed, 1 Oct 2008 18:56:09 +0200 (CEST) Received: from [10.0.13.104] (ip129-15-211-87.adsl2.static.versatel.nl [87.211.15.129]) by mx1.moulin.nl (Postfix) with ESMTP id AF62227E8F9; Wed, 1 Oct 2008 18:56:09 +0200 (CEST) Message-ID: <48E3ABA9.9010604@iamjochem.com> Date: Wed, 01 Oct 2008 18:56:09 +0200 User-Agent: Thunderbird 2.0.0.17 (Macintosh/20080914) MIME-Version: 1.0 To: Derick Rethans CC: Greg Beaver , internals@lists.php.net References: <48D47532.8080102@chiaraquartet.net> In-Reply-To: X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] solving the namespace conflict issues between function/static method class constant/ns constant From: jochem@iamjochem.com (Jochem Maas) Derick Rethans schreef: > On Fri, 19 Sep 2008, Greg Beaver wrote: > >> Hi all, >> >> There is a problem in the namespace implementation. This code demonstrates >> the issue: >> >> code.inc: >> > namespace foo; >> class test { >> const my = 1; >> static function bar(){} >> } >> >> namespace foo::test; >> const my = 2; >> function bar(){} >> ?> >> >> main.php: >> > include 'code.inc'; >> foo::test::bar(); // always calls namespace function >> call_user_func(array('foo::test', 'bar')); // the only way to call static >> method >> echo foo::test::my; // always 2 >> $a = new foo::test; >> echo $a::my; // the only way to access foo::test::my >> ?> >> >> There are 5 ways to solve this: >> >> 1) document it and hope no one uses it [this is the current strategy, minus >> the documentation part] >> 2) add a fatal error on conflicting names. > > Uh, if we don't have functions in namespaces, then the second "function > bar(){}" would define the bar function in the global scope only and not > as part of the foo::test namespace... so one more reason to remove > functions (and constants) from namespaces? I don't follow the logic. if we don't have functions in namespaces the second "function bar(){}" would be a parse error, no? > > regards, > Derick