Re: multiple namespace per file
| From: | David Coallier | Date: | Mon, 10 Sep 2007 23:28:15 +0000 |
| Subject: | Re: multiple namespace per file | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32222@lists.php.net to get a copy of this message | ||
On 9/10/07, Stanislav Malyshev <stas@zend.com> wrote:
> 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 :)
Good call :)
> --
> Stanislav Malyshev, Zend Software Architect
> stas@zend.com http://www.zend.com/
> (408)253-8829 MSN: stas@zend.com
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Ok, I was wondering to myself, do you guys think it would be possible
to do something like having an endnamespaces; keyword that would put
an end to the namespace definition?
For instance:
<?php
namespace A;
class AX{}
class AY{}
namespace B;
class BX{}
endnamespaces;
class BAX{}
class Extern {}
?>
I am trying to find a way to put a delimiter to the namespaces definitions..
I'm ready and open for a good and constructive discussion :) No more hate.
--
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18