Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31816 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46290 invoked by uid 1010); 21 Aug 2007 21:29:26 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 46273 invoked from network); 21 Aug 2007 21:29:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2007 21:29:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 38.99.98.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 38.99.98.18 beast.bluga.net Linux 2.6 Received: from [38.99.98.18] ([38.99.98.18:58883] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 99/E2-28809-4395BC64 for ; Tue, 21 Aug 2007 17:29:25 -0400 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 8BEACC0D86B; Tue, 21 Aug 2007 14:29:21 -0700 (MST) Received: from [192.168.0.106] (CPE-76-84-1-170.neb.res.rr.com [76.84.1.170]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id E4F53C0D865; Tue, 21 Aug 2007 14:29:20 -0700 (MST) Message-ID: <46CB59C0.1020306@chiaraquartet.net> Date: Tue, 21 Aug 2007 16:31:44 -0500 User-Agent: Thunderbird 1.5.0.12 (X11/20070604) MIME-Version: 1.0 To: Stanislav Malyshev CC: Dmitry Stogov , 'internals Mailing List' References: <46C9F217.8040804@chiaraquartet.net> <000001c7e3cb$9a80b160$6e02a8c0@thinkpad> <46CB3DF1.5090203@chiaraquartet.net> <46CB55A0.3050904@zend.com> In-Reply-To: <46CB55A0.3050904@zend.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PHP-DEV] [PATCH] allowing multiple namespaces per file plus namespaces with brackets From: greg@chiaraquartet.net (Gregory Beaver) Stanislav Malyshev wrote: >> that if you try to "combine" two files that contain import statements, >> it will be necessary to expand the imports. Fortunately, since > > What do you mean by "expand"? > >> import allows aliasing specific namespaced files and classes within a >> file. For example: > > But import has nothing to do with files. import works on names, not files. s/files/functions/ I mis-typed and didn't notice, sorry. >> > namespace foo { >> class bar {} >> } >> import foo::bar; >> namespace gronk { >> class bar {} >> } >> ?> >> >> Fatal error: Class name 'bar' coflicts with import name > > Ouch! So I can't actually combine namespaces from different areas - > how I'm supposed to know when I write "gronk" that somebody is going > to stick this code into the context that already has the name "bar" in > it? It's exactly the problem namespaces are meant to solve! Moreover, > if you take two files with working code and copy-paste them into one > file, they have a lot of chance of stopping working. If this isn't > confusion, I don't know what is. Careful Stas :), you probably missed the "import foo::bar;" This code works just fine: No fatal errors, everybody is happy. The problem is importing the "bar" identifier. This code also fails with the same fatal error for the same reason: file1.php: file2.php: >> That will clear up any possible confusion. > > No, on the contrary - it would create a lot of confusion, since now > you can break namespaced code with code outside namespace, which > wasn't supposed to happen by definition. It still doesn't. As I pointed out above, the same error is possible with the current implementation pre-my patch. >> Well it kind of makes namespaces behave more like namespaces, don't you > > Please stop this "only C++ implementation is right" thing. I don't care about C++. I'm only talking about the patch I proposed. Thanks, Greg