Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31240 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3272 invoked by uid 1010); 24 Jul 2007 15:53:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 3257 invoked from network); 24 Jul 2007 15:53:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2007 15:53:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:53499] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/31-29584-C8026A64 for ; Tue, 24 Jul 2007 11:53:49 -0400 Received: from trainburn-lm-corp-yahoo-com.local (static-64-65-140-161.dsl.pdx.eschelon.com [64.65.140.161]) (authenticated bits=0) by mail.lerdorf.com (8.14.1/8.14.1/Debian-7) with ESMTP id l6OFr59g018178 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 24 Jul 2007 08:53:31 -0700 Message-ID: <46A6205A.6040001@lerdorf.com> Date: Tue, 24 Jul 2007 08:52:58 -0700 User-Agent: Thunderbird 2.0.0.5 (Macintosh/20070716) MIME-Version: 1.0 To: Matthew Kavanagh CC: Stanislav Malyshev , Andrew Minerd , "'PHP Internals'" References: <46A31D95.2080407@fischer.name> <46A4661A.6080202@zend.com> <200707231140.55535.pstradomski@gmail.com> <46A4BA4F.6090506@dealnews.com> <40CA6572-030F-43E2-8706-64D1167C527C@bitxtender.com> <46A4C090.50402@php.net> <3d1a63d10707230942y2b2504d1p5f995f01d28a622b@mail.gmail.com> <46A4DF33.1030403@zend.com> <20070723110303.0c033048@h4x0r.tss> <46A4EEBA.7040308@zend.com> <46A53A50.1020205@lerdorf.com> <46A5FA0B.7040708@teh.ath.cx> In-Reply-To: <46A5FA0B.7040708@teh.ath.cx> X-Enigmail-Version: 0.95.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.91.1/3754/Tue Jul 24 06:41:21 2007 on colo.lerdorf.com X-Virus-Status: Clean Subject: Re: [PHP-DEV] Question about Namespace patch From: rasmus@lerdorf.com (Rasmus Lerdorf) Matthew Kavanagh wrote: > Rasmus Lerdorf wrote: >> Stanislav Malyshev wrote: >> >>> Compile-time resolution means you don't get performance penalty for >>> namespaces when you are not using it, and have very low costs when you >>> do use it. Allowing blanket imports means we don't know what "new Foo()" >>> means until it is executed - meaning we need to make extra lookups on >>> each class fetch, even if the code doesn't use namespaces at all. That's >>> only one problem with blanket imports. >>> >> >> And a fatal one in my book. For the folks arguing so passionately about >> this namespace implementation, try to consider the compiler vs. executor >> issues involved. We really need to stop the trend of pushing everything >> down into the executor. >> >> -Rasmus >> >> > The compile time vs. execution time argument may be a good one against > global import and against other crazy ideas in my head (like allowing > statements in namespaces). > > But why not allow importing namespaced functions and constants into the > global namespace? > > If this were added then "blanket import" could be left to the intrepid > and foolhardy programmer to do manually. It'd just end up being > boilerplate and if someone really objects to some extra lines they could > add an explicit fold in their editor to hide it. As long as it doesn't go into the global namespace directly. As in: namespace foo; class bar1 { ... } class bar2 { ... } import foo:* as myfoo gives you: myfoo:bar1 and myfoo:bar2 and not bar1 and bar2 directly in the global namespace. The latter is a performance killer across the board but I see no issue with the former. -Rasmus