multiple namespace per file

From: Date: Mon, 10 Sep 2007 23:21:07 +0000
Subject: multiple namespace per file
Groups: php.internals 
Request: Send a blank email to internals+get-32220@lists.php.net to get a copy of this message
Hi! Following the feedback from the community, we (mostly me and Dmitry) tried to find a good model that would allow multiple namespaces per file without running into too many problems and complications, and would allow to bundle multiple namespaced files together without modifications. It looks like it is possible to do, but only under the following condition: the file can have multiple namespaces, but if the file has namespaces, then it can have no code outside namespaces. For example, this would work: namespace A; class X {} namespace B; class Y {} This would not work: class X {} namespace A; class Y {} This would not work either: require 'foo/bar.php'; namespace A; class X {} This however would work: namespace A; require 'foo/bar.php'; class X {} namespace B; class Y {} So, for the people that wanted multiple NS per file, would such solution work? P.S. this is *not* a "should we use braces" thread, so please don't :) -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#32220) next »