Hello Stanislav,

Tuesday, September 11, 2007, 1:21:07 AM, you 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 looks very messy. We should either go with curly braces or with one
namespace at the top of a file. And even if we do multiple namespaces per
file. I guess we do not allow a naespace to be spread onto several files,
right?

The current implementation is not clear at all. Since everything following
a namespace declaration belongs into that declaration and since nothing is
allowed ontop of that declaration I'd expect that the second namespace would
actually create an inner naespace. Either way dealing with this without
curly braces requires an IDE while today I still edit nearly all of my PHP
with a simple text editor. And even when assuming everyone would use an IDE,
the implementation of multiple braceless namespace is very tricky and more
important hard to visualize and thus confusing for the user.

marcus

> 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
> [EMAIL PROTECTED]   http://www.zend.com/
> (408)253-8829   MSN: [EMAIL PROTECTED]




Best regards,
 Marcus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to