Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32226 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43638 invoked by uid 1010); 11 Sep 2007 00:02:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 43623 invoked from network); 11 Sep 2007 00:02:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Sep 2007 00:02:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.114 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.114 unknown Windows 2000 SP4, XP SP1 Received: from [63.205.162.114] ([63.205.162.114:64109] helo=us-ex1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/C2-28088-92BD5E64 for ; Mon, 10 Sep 2007 20:02:49 -0400 Received: from [127.0.0.1] ([192.168.16.180]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 10 Sep 2007 17:02:47 -0700 Message-ID: <46E5DB23.80805@zend.com> Date: Mon, 10 Sep 2007 17:02:43 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: David Coallier CC: PHP Internals References: <46E5D163.4050800@zend.com> <46E5D567.8090205@zend.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 11 Sep 2007 00:02:47.0846 (UTC) FILETIME=[163E0460:01C7F407] Subject: Re: [PHP-DEV] multiple namespace per file From: stas@zend.com (Stanislav Malyshev) > > namespace A; > require 'somefile.php'; > class AX{} > > namespace B; > class BX{ } > > ?> > > is somefile.php also included in the B namespace since you cannot > include it in global scope. No, somefile.php does not automatically belong to either A or B, it can contain namespaces definition inside and thus belong to either A or B or neither, but it is parsed as entirely separate entity. I general once the file is done, everything is forgotten (what happens in the file, stays in the file ;). Also remember require is run-time so it can't influence namespaces since those are compile-time (in other words, when we parse namespaces we don't know what's in somefile.php, when we parse somefile.php we don't know namespaces in including file existed). -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com