Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41841 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8949 invoked from network); 10 Nov 2008 22:11:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Nov 2008 22:11:48 -0000 Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 69.16.228.148 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 69.16.228.148 unknown Linux 2.4/2.6 Received: from [69.16.228.148] ([69.16.228.148:40268] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/A1-34173-3A1B8194 for ; Mon, 10 Nov 2008 17:11:47 -0500 Received: from [83.228.56.37] (port=2431 helo=pc) by host.fmethod.com with esmtpa (Exim 4.69) (envelope-from ) id 1Kzez2-0006AZ-Kg for internals@lists.php.net; Mon, 10 Nov 2008 16:11:45 -0600 Message-ID: To: References: <49188698.1050505@grudl.com> <49188BD0.9090100@kukulich.net> <4918A3F8.4070809@chiaraquartet.net> <4918AFE1.70506@grudl.com> Date: Tue, 11 Nov 2008 00:11:40 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-2"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.fmethod.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fmethod.com Subject: Re: [PHP-DEV] Re: Namespace resolution rules has been changed? From: sv_forums@fmethod.com ("Stan Vassilev | FM") > I understand this new behaviour is same as using "relative paths", but > there is a common best practise to not make dependencies form topper > namespaces to deeper ones. > So it is rare to have class Company\Software\Base extending > Company\Software\Web\Forms\Control (i.e. Base extends Web\Forms\Control), > and it is common have class Company\Software\Web\Forms\Control extending > Company\Software\Base. > > So in real world it means that nearly every usage of "partially qualified > indentifiers" (Sub\Object) have to be written with preceding backslash. > > David Grudl Can you please point us to an example describing this best practice? Aside from this, the problem is: scopes. In other languages we don't have preceding separators and those conflicts hence don't exist, since with scopes, if a name doesn't exist in the local scope, it's automatically bubbled up until it goes right back to the global scope. In PHP nothing bubbles, hence this doesn't work. We have just one exception to this, with global functions in local space which "bubble up" to global even without the prefix (which I believe will come to bite us later on). However there's still one more issue, "use" clauses only understand full symbol names, which causes yet another inconsistency: namespace foo; use bar\baz as bar_baz; $a = new bar\baz(); //instantiates class with absolute path "foo\bar\baz" $b = new bar_baz(); //instantiates class absolute path "bar\baz" In fact, use doesn't even know what the prefix would mean: use \bar\baz; // parse error So it has to be decided which way the system goes to avoid confusion and bugs IMO. Regards, Stan Vassilev