Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40593 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4508 invoked from network); 21 Sep 2008 14:59:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Sep 2008 14:59:52 -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 208.83.222.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 208.83.222.18 unknown Linux 2.6 Received: from [208.83.222.18] ([208.83.222.18:38896] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/7B-65213-66166D84 for ; Sun, 21 Sep 2008 10:59:50 -0400 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 6FC33C0EC8F; Sun, 21 Sep 2008 07:58:49 -0700 (MST) Received: from Greg-Beavers-monster.local (unknown [76.84.4.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id EB839C0EC84; Sun, 21 Sep 2008 07:58:48 -0700 (MST) Message-ID: <48D66160.40306@chiaraquartet.net> Date: Sun, 21 Sep 2008 09:59:44 -0500 User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070807) MIME-Version: 1.0 To: Lupus Michaelis CC: internals@lists.php.net References: <48D47532.8080102@chiaraquartet.net> <10845a340809201643q59e27211i471e09241f7253b1@mail.gmail.com> <200809202000.38870.larry@garfieldtech.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PHP-DEV] solving the namespace conflict issues between function/staticmethod class constant/ns constant From: greg@chiaraquartet.net (Greg Beaver) Lupus Michaelis wrote: > Larry Garfield a écrit : > >> I agree that #5 seems like the best solution. The problem is caused >> by the double meaning of ::. All of the other solutions feel like >> bandaids. > > > They are not a double meaning : it is a scope resolver. Like in C++. > So please all stop this war about namespaces, and look where it was > resolved in other languages. It will be wisely :) Hi, Amazingly enough, this work has already been done. The first thing noticed is that C++ is a compiling language, and PHP isn't. Therefore at compile time, it is possible to know every single file that will be available, every single class, and so on. This enables all kinds of clever resolution such as importing ns::* and it actually works with full performance. PHP, on the other hand, is a dynamic language, and it is impossible to know in advance which files, which classes, which namespaces will be defined. Other dynamic languages that have implemented namespaces have solved the problems mentioned via run-time resolution, which is much slower. One key difference from C++ is that namespaces do *not* define scope in PHP. The only constructs that define scope different from global scope are functions and now closures (as I understand them from reading the mailing list). I suppose I should have mentioned option #6: do all class, function and constant resolution at run-time, "obsoleting" all opcode caches and make PHP 5.3 an unusable release for any high traffic websites. Greg